Вопрос

I would truly appreciate some help with developing a simple pub/sub flow using message broker 7.0 and MQ 7.0

My flow is supposed to accept a certain message with no header, filter it based on the field (process, if the value is "yes") And then publish the body to all the queues, listed in nodes of the message

<pub>
  <header>
       <topics>
           <topic> Topic1  </topic>
           <topic> Topic2  </topic>
       </topics>

       <properties>
          <property>
                          <publish>yes</publish>
                  </property>     
           </properties>
   </header>

   <body>  
      <a>
         <b>The publication </b>
      </a>
   </body> 
</pub>

This is my flow:

message flow

I registered a Topic and a Subscription in MQ, but I'm pretty much lost what am I supposed to do next. I used RFHUtil for testing point-to-point application, but have no idea, how to make use of the it while developing publish-subscribe.

questions: 1. Is it correct to use just a simple queue as a publisher ( in MQ input i just set "IN", the queue, i have in MQ) 2. How do I register subscriber/multiple subscribers in this flow? What is the subscription point?

It's just a learning task.

Any help is welcome!

Это было полезно?

Решение

For a normal pub-sub flow you can have something like below:

Sample fLOW

Set, the queue name of MQInput node to your input queue. Let's name it as "inputQ".

Now the message has been read by MQInput node from the "inputQ" and it has been passed on to the compute node.

In the compute node you need to set the message type to publish and also set the topic name, before you pass it to the Publication node.

You can use below code for the same:

SET OutputRoot.MQRFH2.psc.Command = 'Publish';
SET OutputRoot.MQRFH2.psc.Topic = 'YourTopicString';

"How do I register subscriber/multiple subscribers in this flow? "

I am assuming your problem is "How to publish message with different topics from same flow".

Now suppose you have multiple topics to be published from the same flow. You can't do it all at once. One message can have one topic.

But, you can achieve it as below (Suppose you have 3 topics):

SET OutputRoot.MQRFH2.psc.Command = 'Publish';
SET OutputRoot.MQRFH2.psc.Topic = 'Topic1';
PROPAGATE TO TERMINAL 'out' DELETE NONE;
SET OutputRoot.MQRFH2.psc.Topic = 'Topic2';
PROPAGATE TO TERMINAL 'out' DELETE NONE;
SET OutputRoot.MQRFH2.psc.Topic = 'Topic3';
PROPAGATE TO TERMINAL 'out' DELETE NONE;
RETURN FALSE;

However, if your requirement is publishing single topic but multiple queues should pick it up, then its simpler.

You just need to create subscriptions for all those queues for your topic.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top