| Author | Message | 
		
		  | wildtiger | 
			  
				|  Posted: Mon Apr 30, 2007 10:20 am    Post subject: [Urgent]Using Pub/Sub in broker v5 |   |  | 
		
		  |  Acolyte
 
 
 Joined: 21 Apr 2002Posts: 55
 Location: Canada
 
 | 
			  
				| Hi, 
 I'm using Pub/Sub in broker v5. My pub/sub flow doesn't work. Below are my two flows:
 
 
 
   
	| Code: |  
	| Publish Flow:
 
 *-----------*
 |  PUBFAILQ |
 *---------------------------+--|           |
 |                           |  | (MQOUTPUT)|
 |                           |  *-----------*
 |                           |
 |                           |
 *-----------*               |                           |
 |   PUBQ    |----(Failure)--*                           |
 |           |----(Out)------*                           |
 | (MQINPUT) |               |                           |
 *-----------*               |                           |
 |                           |
 |  *-----------*            |
 |  |  Compute  |--(Failure)-*
 +--|           |--(Out)-----*
 | (Compute) |            |
 *-----------*            |
 |  *--------------*
 |  |    Publish   |
 +--|              |
 | (Publication)|
 *--------------*
 
 ESQL in Compute Node:
 
 CREATE COMPUTE MODULE Pub_Compute
 CREATE FUNCTION Main() RETURNS BOOLEAN
 BEGIN
 CALL CopyMessageHeaders();
 -- CALL CopyEntireMessage();
 
 SET OutputRoot.MQRFH2.psc."Command" = 'Publish';
 SET OutputRoot.MQRFH2.psc.Topic = 'MYTOPIC';
 
 RETURN TRUE;
 END;
 
 CREATE PROCEDURE CopyMessageHeaders() BEGIN
 DECLARE I INTEGER 1;
 DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
 WHILE I < J DO
 SET OutputRoot.*[I] = InputRoot.*[I];
 SET I = I + 1;
 END WHILE;
 END;
 
 CREATE PROCEDURE CopyEntireMessage() BEGIN
 SET OutputRoot = InputRoot;
 END;
 END MODULE;
 
 ---------------------------------------------------------------------------------
 Subscribe Flow:
 *-----------*
 |  SUBFAILQ |
 *---------------------------+--|           |
 |                           |  | (MQOUTPUT)|
 |                           |  *-----------*
 |                           |
 |                           |
 *-----------*               |                           |
 |   SUBQ    |----(Failure)--*                           |
 |           |----(Out)------*                           |
 | (MQINPUT) |               |                           |
 *-----------*               |                           |
 |                           |
 |  *-----------*            |
 |  |  Compute  |--(Failure)-*
 +--|           |--(Out)-----*
 | (Compute) |            |
 *-----------*            |
 |  *----------*
 |  | SubscribQ|
 +--|          |
 |(MQOUTPUT)|
 *----------*
 
 
 ESQL in Compute Node:
 
 CREATE COMPUTE MODULE Sub17A_Compute
 CREATE FUNCTION Main() RETURNS BOOLEAN
 BEGIN
 CALL CopyMessageHeaders();
 -- CALL CopyEntireMessage();
 
 SET OutputRoot.MQRFH2.pcs.Command = 'RegSub';
 SET OutputRoot.MQRFH2.pcs.Topic = 'MYTOPIC';
 SET OutputRoot.MQRFH2.pcs.QMgrName = 'MYQM';
 SET OutputRoot.MQRFH2.pcs.QName = 'MYSUBQ';
 
 RETURN TRUE;
 END;
 
 CREATE PROCEDURE CopyMessageHeaders() BEGIN
 DECLARE I INTEGER 1;
 DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
 WHILE I < J DO
 SET OutputRoot.*[I] = InputRoot.*[I];
 SET I = I + 1;
 END WHILE;
 END;
 
 CREATE PROCEDURE CopyEntireMessage() BEGIN
 SET OutputRoot = InputRoot;
 END;
 END MODULE;
 
 --------------------------------------------------------------------------------
 
 
 |  
 When I put a dummy XML message, nothing in the PUBFAILQ.
 When I put a dummy XML message, nothing in the SUBFAILQ.
 I did it a couple of times and found no message in the MYSUBQ.
 I cound not find "MYTOPIC" topic in the "Subscriptions" view.
 
 
 Can anyone kindly help with it?
 
 Thanks in advance!
 
 WT
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | wildtiger | 
			  
				|  Posted: Mon Apr 30, 2007 6:44 pm    Post subject: |   |  | 
		
		  |  Acolyte
 
 
 Joined: 21 Apr 2002Posts: 55
 Location: Canada
 
 | 
			  
				| Anybody can help? The flow is so simple and I must miss something very little. Please help to figure it out. Thanks. |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | vk | 
			  
				|  Posted: Mon Apr 30, 2007 7:21 pm    Post subject: |   |  | 
		
		  | Partisan
 
 
 Joined: 20 Sep 2005Posts: 302
 Location: Houston
 
 | 
			  
				| The MQRFH2 header setting in the subscribe flow is wrong. The folder is spelt as "pcs" instead of "psc". 
 Also, I hope the subscription flow is putting messages into the queue SYSTEM.BROKER.CONTROL.QUEUE
 
 Regards,
 VK.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | wildtiger | 
			  
				|  Posted: Tue May 01, 2007 10:17 am    Post subject: |   |  | 
		
		  |  Acolyte
 
 
 Joined: 21 Apr 2002Posts: 55
 Location: Canada
 
 | 
			  
				| Hi VK, 
 Thank you very much for your help.
 
 I've changed the ESQL of Pub flow from "psc" to "pcs". But it still not working. Also, the queue name for SubscribQ is "SYSTEM.BROKER.CONTROL.QUEUE".
 
 After I put a dummy message, nothing failed. But I'm still not able to see the topic from the "Subscriptions" view in broker toolkit. Also no message delivered to "OutputRoot.MQRFH2.pcs.QName" specified in the sub flow.
 
 Do I need to install User Name Server to make it work? Or something else that I missed?
 
 Thanks,
 
 WT
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | wildtiger | 
			  
				|  Posted: Tue May 01, 2007 10:19 am    Post subject: |   |  | 
		
		  |  Acolyte
 
 
 Joined: 21 Apr 2002Posts: 55
 Location: Canada
 
 | 
			  
				| BTW, I have MQSeries Pub/Sub installed. Does it conflict with broker's pub/sub? From manual and redbooks, it looks like not. |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | jefflowrey | 
			  
				|  Posted: Tue May 01, 2007 10:50 am    Post subject: |   |  | 
		
		  | Grand Poobah
 
 
 Joined: 16 Oct 2002Posts: 19981
 
 
 | 
			  
				| 
   
	| wildtiger wrote: |  
	| BTW, I have MQSeries Pub/Sub installed. Does it conflict with broker's pub/sub? From manual and redbooks, it looks like not. |  
 You can't have both on the same qmgr.
 _________________
 I am *not* the model of the modern major general.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | wildtiger | 
			  
				|  Posted: Tue May 01, 2007 12:38 pm    Post subject: |   |  | 
		
		  |  Acolyte
 
 
 Joined: 21 Apr 2002Posts: 55
 Location: Canada
 
 | 
			  
				| Good news. I made one step further. 
 After I put a message through the sub flow. I can see the topic being subscribe on the "Subscriptions" view. But when I put a message to the publish flow, no message is delivered to the subscritpion queue.
 
 Does it mean that the sub flow is good and publish flow has problems?
 
 Thanks,
 
 WT
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | wildtiger | 
			  
				|  Posted: Tue May 01, 2007 12:55 pm    Post subject: |   |  | 
		
		  |  Acolyte
 
 
 Joined: 21 Apr 2002Posts: 55
 Location: Canada
 
 | 
			  
				| Below is the newest esql code in the compute of pub flow: 
 
 
   
	| Code: |  
	| CREATE COMPUTE MODULE Pub17A_Compute1
 CREATE FUNCTION Main() RETURNS BOOLEAN
 BEGIN
 CALL CopyMessageHeaders();
 -- CALL CopyEntireMessage();
 
 SET OutputRoot.MQMD.Format = MQFMT_RF_HEADER_2;
 SET OutputRoot.MQRFH2.psc."Command" = 'Publish';
 SET OutputRoot.MQRFH2.psc.Topic = 'FRUIT_ORANGE';
 
 SET OutputRoot.XML.PubMsg.Header = 'Testing Pub Msg';
 SET OutputRoot.XML.PubMsg.Body = 'Testing Pub Msg Content';
 
 RETURN TRUE;
 END;
 
 CREATE PROCEDURE CopyMessageHeaders() BEGIN
 DECLARE I INTEGER 1;
 DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
 WHILE I < J DO
 SET OutputRoot.*[I] = InputRoot.*[I];
 SET I = I + 1;
 END WHILE;
 END;
 
 CREATE PROCEDURE CopyEntireMessage() BEGIN
 SET OutputRoot = InputRoot;
 END;
 END MODULE;
 
 
 |  
 Still, no message delivered to my subscription queue.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | jefflowrey | 
			  
				|  Posted: Tue May 01, 2007 1:00 pm    Post subject: |   |  | 
		
		  | Grand Poobah
 
 
 Joined: 16 Oct 2002Posts: 19981
 
 
 | 
			  
				| What is the Topic that you subscribed to? 
 What is the Topic that you published to?
 _________________
 I am *not* the model of the modern major general.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | wildtiger | 
			  
				|  Posted: Tue May 01, 2007 8:39 pm    Post subject: |   |  | 
		
		  |  Acolyte
 
 
 Joined: 21 Apr 2002Posts: 55
 Location: Canada
 
 | 
			  
				| Sorry, my mistake. I've changed all topic that I published and subscribed to "FRUIT_ORANGE". 
 ...... any advice?
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | dilse | 
			  
				|  Posted: Wed May 02, 2007 7:58 am    Post subject: |   |  | 
		
		  |  Master
 
 
 Joined: 24 Jun 2004Posts: 270
 
 
 | 
			  
				| wildtiger, I hope you are seeing the topic in 'FRUIT_ORANGE' in the subscribers list.
 If Yes, then try to add these two lines in the Publish flow compute node.
 
 
 
   
	| Code: |  
	| SET OutputRoot.MQMD.MsgType = MQMT_REQUEST; SET OutputRoot.MQMD.ReplyToQ = 'BROKER.REPLY.QUEUE';
 |  
 Do not forget to create a 'BROKER.REPLY.QUEUE' queue in your Publish Queue Manager. This way you will know the reason code if it is failing to publish for any reason.
 
 Hope this helps.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |