0
votes

I've a list of subscriber which i'm getting from a java component in mule flow and for each subscriber i've queue in which i want to publish the payload. Payload is same for all subscriber. I'm looking at two option -
1. ForEach 2. Collection Splitter
which one fits in this scenario and how to achieve this ?

2

2 Answers

0
votes

For the scenario you have specified both the processors of Mule should do the job.

I would suggest you go with collection-splitter as you just need to post each item onto a queue.

Try the following approach

<flow name="sampleFlow">
    ....  some inbound endpoint....
    .... some message processors ....
    <component  >  ... component generating the collections as output payload ...
    <collection-splitter enableCorrelation="IF_NOT_SET"></collection-splitter>
    <jms:outbound-endpoint queue="subscriber.queue.name"   connector-ref="jmsconnector" exchange-pattern="one-way" />
</flow>

Hope this helps.

0
votes

u can use scatter-gather in the new run time of mule , but for the same requirement in old version can save payload in temp variable and use all router and in each branch get that payload from temp variable using the set payload before calling to jms outbound.