Author |
Message
|
pdrabik |
Posted: Wed Sep 19, 2007 9:06 am Post subject: need assistance with publish/subscribe flow |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
Hello, Im trying to design pub/sub flows with Message Broker Toolkit 6.0. And I could not succeed. There is no subscriber or publisher registered.
Let me present how Im doing this:
Flow is started with MQInput node - awaiting for trigger message, on trigger queue named 'trig'. If so, if flow recieve something on that queue, the flow procceed to compute node where Im trying to prepare command for registering subscriber as folows:
Code: |
REATE COMPUTE MODULE scheduler_create_publisher
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
--CALL CopyEntireMessage();
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER;
DECLARE J INTEGER;
SET I = 1;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
SET OutputRoot.MQRFH2.(MQRFH2.Field)Format = 'MQFMT_RF_HEADER_2';
SET OutputRoot.MQRFH.psc.Command = 'RegSub';
SET OutputRoot.MQRFH.psc.Topic = 'test/topic1';
SET OutputRoot.MQRFH.psc.QMgrName = 'WBRK6_DEFAULT_QUEUE_MANAGER';
SET OutputRoot.MQRFH.psc.QName = 'local1';
SET OutputRoot.MQRFH.psc.RegOpt = 'RegOpt';
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE; |
1. If I am not mistaken, I register subscriber on topit test/topic1 on 'local1' queue. Right ?
Then.. the flow goes to MQOutput node, where I send that prepared message to SYSTEM.BROKER.CONTROL.QUEUE queue.
The same with publisher.
The command is prepared like this:
Code: |
CREATE COMPUTE MODULE scheduler_create_publisher1
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
CALL CopyEntireMessage();
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER;
DECLARE J INTEGER;
SET I = 1;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
SET OutputRoot.MQRFH2.(MQRFH2.Field)Format = 'MQFMT_RF_HEADER_2' ;
SET OutputRoot.MQRFH2.(MQRFH2.Field)NameValueCCSID = 1208;
SET OutputRoot.MQRFH2.psc."Command" = 'Publish';
SET OutputRoot.MQRFH2.psc.Topic = 'test/topic1';
SET OutputRoot.MQRFH2.psc.QName = 'local1';
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE; |
This is also to be sent to SYSTEM.BROKER.CONTROL.QUEUE to register the publisher.
Is it the right way to do that ?
Could you lead me how to create publish flow and subscirbe flow.
Regards. _________________ ---
cc: poltreak@o2.pl |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Sep 19, 2007 9:18 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
In v6, you need to set the Topic in the Properties, not the MQRFH2. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
dilse |
Posted: Wed Sep 19, 2007 2:29 pm Post subject: |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
Quote: |
In v6, you need to set the Topic in the Properties, not the MQRFH2. |
Actually you could do it either way.
But one thing forgot to put in the code is the following line:
Code: |
SET OutputRoot.MQMD.Format = MQFMT_RF_HEADER_2; |
Also set all the values in the MQRFH2 header instead of MQRFH
Quote: |
SET OutputRoot.MQRFH2.psc.Command = 'RegSub';
SET OutputRoot.MQRFH2.psc.Topic = 'test/topic1';
SET OutputRoot.MQRFH2.psc.QMgrName = 'WBRK6_DEFAULT_QUEUE_MANAGER';
SET OutputRoot.MQRFH2.psc.QName = 'local1';
SET OutputRoot.MQRFH2.psc.RegOpt = 'RegOpt'; |
Hope this helps!!!
DilSe.. |
|
Back to top |
|
 |
pdrabik |
Posted: Wed Sep 19, 2007 11:38 pm Post subject: |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
jefflowrey wrote: |
In v6, you need to set the Topic in the Properties, not the MQRFH2. |
So, should I prepare publish/subscribe command with Properties ? Could you pls, present such an example.
Anyway, is there any opensource flow sample, about publish/subscribe ?
With WMBT, there is Soccer sample included, but pub/sub is created in c code. I would like to see how it may be created within broker flows.
Unfortunately, all your hints doesnt help me with that pub/sub.
Pls confirm if:
1. command should be in MQRFH2 ?
2. prepared command with ESQL should be sent to SYSTEM.BROKER.CONTROL.QUEUE (SBCQ) ?
3. Publication Node should be inserted where I propagate command message to SBCQ or with MQInput Node configured for subscription queue? _________________ ---
cc: poltreak@o2.pl |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Sep 20, 2007 2:49 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
The publish should be linked to a publish node which will be the end of the flow...
It still needs the RFH2 with the publish command  _________________ MQ & Broker admin |
|
Back to top |
|
 |
pdrabik |
Posted: Thu Sep 20, 2007 4:15 am Post subject: |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
this is what doc says, yet it give me no clue why my flows doesnt work.
Doc also says:
Quote: |
The publisher sends a Publish command message to the input node of a message flow that contains a Publication node. |
As I recall, Publish command is:
SET OutputRoot.MQRFH2.psc.Command = 'Publish';
SET OutputRoot.MQRFH2.psc.Topic = 'test/topic1';
I also includes:
SET OutputRoot.MQMD.Format = MQFMT_RF_HEADER_2 ;
So, how should publisher flow looks like.
for sure: MQInput Node
and Publication Node
What queue should be defined in MQInput Node ? subscription queue ?
Then, from previous brief of documentation we read that publication command is to be sent to input node of our publisher, right ? So, to MQInput Node ? So, to that queue specified in the MQInput Node ?
Do they mean that, command should be sent with another flow, designed to prepare publication command and sends it with MQOutput Node ?
What about subscriber. It should be registered to the broker with subcription command. So, that command should be prepared something like this:
SET OutputRoot.MQMD.Format = MQFMT_RF_HEADER_2;
SET OutputRoot.MQRFH2.psc.Command = 'RegSub';
SET OutputRoot.MQRFH2.psc.Topic = 'test/topic1';
SET OutputRoot.MQRFH2.psc.QMgrName = 'WBRK6_DEFAULT_QUEUE_MANAGER';
SET OutputRoot.MQRFH2.psc.QName = 'local1';
SET OutputRoot.MQMD.ReplyToQ = 'replies';
SET OutputRoot.MQRFH2.psc.RegOpt = 'RegOpt';
and directed to MQOutput Node, where it will be put to System.Broker.Control.Queue, right ? In that point we should have subscriber registered, while I have none.
Can you point out where am i mistaken, what is wrong with my flows, or can you make a sample flows for me. _________________ ---
cc: poltreak@o2.pl |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 20, 2007 4:22 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It's telling you to configure a flow that will read messages, and build a publication message from them, and send that to a publication node.
Like MQInput-->Compute-->Publication
This assumes two things: 1) that you don't want your sending applications to build the publication message themselves, 2) that you don't want applications talking directly to the SYSTEM.BROKER.CONTROL.QUEUE. Which they need to do anyway for registering subscriptions, so...
The Publication node does a few more things, I think, than just put messages on the S.B.C.Q. I think it also handles publishing messages to RealTime and other transports directly, rather than passing that off to the process that reads from S.B.C.Q.
It's really not clear, though. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
pdrabik |
Posted: Thu Sep 20, 2007 4:44 am Post subject: |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
Ok, that all about publication. May be it will work, anyway, I still cant figure out why I cant register the subscriber.
For that purpose, I have this flow prepared:
Compute node, where i prepare subscription command, as I presented before. Such prepared message is propageted to MQOutput Node with S.B.C.Q queue, so command should be executed, rright ?
Anyway, in subscriptions in Domains view there is no subscribers.
What else, doc says about pscr, which shoudl be included with responding message right ? How can I read this content ? _________________ ---
cc: poltreak@o2.pl |
|
Back to top |
|
 |
Vitor |
Posted: Thu Sep 20, 2007 4:47 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
pdrabik wrote: |
What else, doc says about pscr, which shoudl be included with responding message right ? How can I read this content ? |
It sends a response message to the reply queue, in XML format IIRC.
Check the pub/sub doc to be sure. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
pdrabik |
Posted: Thu Sep 20, 2007 5:12 am Post subject: |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
While preparing command messages i've configured MQMD.ReplyToQ value. Pls, confirm this is the place where pscr will be thrown?
Although, there is nothing sent to that queue in my project.
So, how would you ppl organize the subscriber flow ? Begin with its registration. _________________ ---
cc: poltreak@o2.pl |
|
Back to top |
|
 |
Vitor |
Posted: Thu Sep 20, 2007 5:18 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
pdrabik wrote: |
While preparing command messages i've configured MQMD.ReplyToQ value. Pls, confirm this is the place where pscr will be thrown? |
IIRC, though it's been a while. Maybe you need to set a reporting option or something, though I don't remember one.
pdrabik wrote: |
Although, there is nothing sent to that queue in my project.
|
Then I'd theorise your pub command never made it.
pdrabik wrote: |
So, how would you ppl organize the subscriber flow ? Begin with its registration. |
What's your daily rate, and where should I send the invoice??
"Organize the subscriber flow" as about as broad as "design this program". I'd create a flow, register it as a subscriber & sit back but I suspect you know that all ready. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
pdrabik |
Posted: Thu Sep 20, 2007 5:33 am Post subject: |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
Let me ask you thise way, instead of creation (only) sample flow for registering subscriber (one i have already seen on the forum, doesnt work for me) pls help me find the issue why my flow is bad.
One more time, flow looks like that:
mqinput node
>queue* = trig
This node awaits trigger message on queue named 'trig'
Compute node
Code: |
CREATE COMPUTE MODULE scheduler_create_publisher
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
--CALL CopyEntireMessage();
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER;
DECLARE J INTEGER;
SET I = 1;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
SET OutputRoot.MQMD.Format = MQFMT_RF_HEADER_2;
SET OutputRoot.MQRFH2.psc.Command = 'RegSub';
SET OutputRoot.MQRFH2.psc.Topic = 'test/topic1';
SET OutputRoot.MQRFH2.psc.QMgrName = 'WBRK6_DEFAULT_QUEUE_MANAGER';
SET OutputRoot.MQRFH2.psc.QName = 'local1';
SET OutputRoot.MQMD.ReplyToQ = 'replies';
SET OutputRoot.MQRFH2.psc.RegOpt = 'RegOpt';
SET OutputRoot.Properties.Topic = 'test/topic1';
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
--SET OutputRoot.MQRFH2.psc.Command = 'RegSub';
--SET OutputRoot.MQRFH2.psc.Topic = 'test/topic1';
--SET OutputRoot.MQRFH2.psc.QMgrName = 'WBRK6_DEFAULT_QUEUE_MANAGER';
--SET OutputRoot.MQRFH2.psc.QName = 'local1';
--SET OutputRoot.MQRFH2.psc.RegOpt = 'RegOpt';
-- SET OutputRoot.MQRFH2.psc.Command = 'Publish';
SET OutputRoot = InputRoot;
END;
END MODULE;
|
mqoutput node
>queue name= S.B.C.Q
This is to send the command to register subscriber.
And trace nodes to manage log.
Ok. The flow is deployed. I trigger the flow puting whatever to 'trig' queue. There are no errors along the flow, however, there is no subscriber registered, no pscr recieved.
What seems to be a problem ? _________________ ---
cc: poltreak@o2.pl |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 20, 2007 5:37 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It's not clear why the subscription request is failing.
It's a little more clear why you're not getting a response from the broker to the subscription request.
You'll need to set the MQMD to indicate that the message is a Request and not a Datagram.
Also, this is a code style comment. It's a bad idea to put any of your own code into CopyEntireMessage or CopyMessageHeaders.
It will thoroughly confuse anyone who has to maintain the code. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
pdrabik |
Posted: Thu Sep 20, 2007 5:45 am Post subject: |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
How to set the MQMD to indicate that is the request ? _________________ ---
cc: poltreak@o2.pl |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 20, 2007 5:50 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If I'd remembered how to do that off the top of my head, I'd have indicated it.
It's hopefully about as quick for you to look it up as it is for me.
And less typing on my part. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|