How to connect to a network of activemq brokers from a client application?

老子叫甜甜 提交于 2019-12-24 08:48:16

问题


I have setup a network of brokers in activemq, how do i connect to that from my client application

I tried with

network:static:(tcp://master1.IP:61616,tcp://master2.IP:61617) and

but I get the following exception

javax.jms.JMSException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Could not create Transport. Reason: java.io.IOException: Transport scheme NOT recognized: [network]; 

With

static:(tcp://master1.IP:61616,tcp://master2.IP:61617)

I get exception

javax.jms.JMSException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Could not create Transport. Reason: java.io.IOException: Transport scheme NOT recognized: [static]; 

Thanks


回答1:


"Clients wishing to failover to a static list of broker instances, should use the failover:// transport instead." (from : http://activemq.apache.org/static-transport-reference.html)

so the correct syntax would be:

failover:(tcp://master1.IP:61616,tcp://master2.IP:61617)




回答2:


For Connecting in Network of Brokers, we can use Multicast as follows: In ActiveMQ.xml:

<transportConnectors>
<transportConnector name="openwire"  uri="tcp://IP1:61616" discoveryUri="multicast://default?group=GROUPNAME"/>
</transportConnectors>

<networkConnectors>
<networkConnector uri="multicast://default?group=GROUPNAME"/>
</networkConnectors>

And in the client side API:

discovery:(multicast://default?group=GROUPNAME)


来源:https://stackoverflow.com/questions/2421198/how-to-connect-to-a-network-of-activemq-brokers-from-a-client-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!