| Author | 
		  Message
		 | 
		
		  | ram_svnit | 
		  
		    
			  
				 Posted: Wed Oct 21, 2009 5:20 am    Post subject: How to route a message to one of many queues? | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 28 Aug 2009 Posts: 20 Location: India 
  | 
		  
		    
			  
				Hi, based on some element value in input XML message i need to route the the output message to a specific MQ output queue.How do i achieve this?
 
I have changed the Destination Mode of output queue to Destiantion List.
 
I tried the following code:
 
SET OutputLocalEnvironment.Destination.MQ.Defaults.queueManager='WBRK61_DEFAULT_QUEUE_MANAGER';
 
		IF InputRoot.XMLNSC.ns1:TargetOrder.ns1:FCAreaCode ='100000' THEN 
 
			SET OutputLocalEnvironment.Destination.MQ.Defaults.queueName='FULFILLMENTCENTER1';
 
					ELSEIF InputRoot.XMLNSC.ns1:TargetOrder.ns1:FCAreaCode='100001' THEN
 
			SET OutputLocalEnvironment.Destination.MQ.Defaults.queueName='FULFILLMENTCENTER2';
 
		ELSE
 
			SET OutputLocalEnvironment.Destination.MQ.Defaults.queueName='FULFILLMENTCENTER3';
 
		END IF; | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Gaya3 | 
		  
		    
			  
				 Posted: Wed Oct 21, 2009 5:22 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi
 
 Joined: 12 Sep 2006 Posts: 2493 Location: Boston, US 
  | 
		  
		    
			  
				use Route to Label
 
or Local Environment.Destination Properties to do the same
 
 
you have to use Propagate command to push the data out
 
 
and first of all 
 
 
Go through the MB and MQ Basics, it will give fair idea about this _________________ Regards
 
Gayathri
 
-----------------------------------------------
 
Do Something Before you Die
  Last edited by Gaya3 on Wed Oct 21, 2009 5:23 am; edited 1 time in total | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Wed Oct 21, 2009 5:23 am    Post subject: Re: How to route a message to one of many queues? | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| ram_svnit wrote: | 
   
  
	| I tried the following code: | 
   
 
 
 
What happened when you tried this? Presumably not what you wanted?
 
 
Did you remember to change the Compute node to pass LocalEnvironment to the MQOutput node? _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Wed Oct 21, 2009 5:25 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| Gaya3 wrote: | 
   
  
	| you have to use Propagate command to push the data out | 
   
 
 
 
Not necessarially. Propagate is best used when you have to generate 2 or more outputs from a single input. A single input, with multiple destinations, it's better to let WMB handle it.[/quote] _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | smdavies99 | 
		  
		    
			  
				 Posted: Wed Oct 21, 2009 5:34 am    Post subject: Re: How to route a message to one of many queues? | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land. 
  | 
		  
		    
			  
				
   
	| ram_svnit wrote: | 
   
  
	
 
   
	| Code: | 
   
  
	SET OutputLocalEnvironment.Destination.MQ.Defaults.queueManager='WBRK61_DEFAULT_QUEUE_MANAGER';
 
      IF InputRoot.XMLNSC.ns1:TargetOrder.ns1:FCAreaCode ='100000' THEN 
 
         SET OutputLocalEnvironment.Destination.MQ.Defaults.queueName='FULFILLMENTCENTER1';
 
               ELSEIF InputRoot.XMLNSC.ns1:TargetOrder.ns1:FCAreaCode='100001' THEN
 
         SET OutputLocalEnvironment.Destination.MQ.Defaults.queueName='FULFILLMENTCENTER2';
 
      ELSE
 
         SET OutputLocalEnvironment.Destination.MQ.Defaults.queueName='FULFILLMENTCENTER3';
 
      END IF;
 
 | 
   
 
 | 
   
 
 
You have got the output side wrong. If should be
 
 
   
	| Code: | 
   
  
	
 
set OutputLocalEnvironment.Destination.MQ.DestinationData[1].queueName = <insert your name here>
 
 | 
   
 
 
You don't need to set the Queue Manager Name if you are writing to queues defined on the local QM.
 
 
Please use the code tags when inserting ESQL, JAva etc into your posts. It makes them much easier to read. _________________ WMQ User since 1999
 
MQSI/WBI/WMB/'Thingy' User since 2002
 
Linux user since 1995
 
 
 
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |