0

I'm trying to use recipientList to send to multiple JMS endpoints. I'm using ActiveMQ as message broker. My problem is: Whether I set the URL as a one single node of ActiveMQ it works perfectly when I set a failover endpoint comma separated I just get that it splits the comma inside the failover URL. Is there a way I can skip this split of commas character inside the failover?

This works:

jms:/myQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://myIP:61616&transport.jms.DestinationType=queue

But this doesn't work because it splits the comma.

jms:/myQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=failover:(tcp://myIP:61616,tcp://myIP2:61616)&transport.jms.DestinationType=queue

In my case I concatenate multiple uris like the ones above with ',' for making the recipientList work, but the comma inside the failover is making it fail.

Is there a work-around?

Thanks,

Antonio

Community
  • 1
  • 1
Tony Montana
  • 36
  • 1
  • 4

2 Answers2

0

You can try like below instead of comma

<send>
 <endpoint key="jmsMBendpoint1"/>
</send>
<send>
 <endpoint key="jmsMBendpoint2"/>
</send>

or you can use Recipienlist endpoint to send a single message to multiple endpoints. After defining recipient list store taht as localentry and provide that as endpoint key.

for more WSO2 ESB send to multiple endpoints

Community
  • 1
  • 1
HM.Rajjaz
  • 369
  • 1
  • 3
  • 17
  • Hi, In this case I'm using dynamic endpoints calculated in runtime, I was already using Recipient List for sending so I cannot use multiple send because till the application gets executed I don't even know how many sends i should use. I had already checked the documentation and code and couldn't get an answer for my problem. Thanks for the reply! – Tony Montana May 17 '17 at 11:09
0

I don't know what is the workaround with recipientlist but an other way to achieve your need is :

<property name="EIP_LIST" type="OM">
    <list xmlns="">
        <epr>jms:/myQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=failover:(tcp://myIP:61616,tcp://myIP2:61616)&amp;transport.jms.DestinationType=queue</epr>
        <epr>jms:/myQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=failover:(tcp://myIP3:61616,tcp://myIP4:61616)&amp;transport.jms.DestinationType=queue</epr>
    </list>
</property>
<iterate expression="$ctx:EIP_LIST//epr">
    <target>
        <sequence>
            <header name="To" expression="$body/epr"/>
            <send/>
        </sequence>
    </target>
</iterate>      

You just have to dynamically compose the content of EIP_LIST

Jean-Michel
  • 5,926
  • 1
  • 13
  • 19