J Kost
J Kost

Reputation: 41

ActiveMQ network connectors syntax

ActiveMQ documentation is not that clear, regarding, and not only, network connector syntax.

E.g. the documentation states that to create a static network of brokers, use the static protocol:

<networkConnectors>
   <networkConnector uri="static:(tcp://<host1>:<port1>,tcp://<host2>:<port2>)"/>
</networkConnectors>

If you wish to use failover, you can't use:

<networkConnectors>
   <networkConnector uri="failover:(tcp://<host1>:<port1>,tcp://<host2>:<port2>)"/>
</networkConnectors>

but

<networkConnectors>
   <networkConnector uri="static:failover:(tcp://<host1>:<port1>,tcp://<host2>:<port2>)"/>
</networkConnectors>

as mentioned here.

masterslave protocol doesn't seem to work in versions 5.10.2 and later.

What if you wish to set some properties, too?

<networkConnectors>
   <networkConnector uri="static:failover:(tcp://<host1>:<port1>,tcp://<host2>:<port2>)?useExponentialBackOff=false"/>
</networkConnectors>

will work, but if you try to add more than one in the uri:

<networkConnectors>
   <networkConnector uri="static:failover:(tcp://<host1>:<port1>,tcp://<host2>:<port2>)?useExponentialBackOff=false&maxReconnectDelay=3000"/>
</networkConnectors>

your broker won't start.

How can you add more properties in the uri? I also tried ; or , as a separator without luck. Any ideas?

Upvotes: 0

Views: 690

Answers (2)

J Kost
J Kost

Reputation: 41

From Matt Pavlovich's comment, in XML files you should use &amp; instead of &:

<networkConnectors>
   <networkConnector uri="static:failover:(tcp://<host1>:<port1>,tcp://<host2>:<port2>)?useExponentialBackOff=false&amp;maxReconnectDelay=3000"/>
</networkConnectors>

or

<networkConnectors>
   <networkConnector uri="masterslave:(tcp://<host1>:<port1>,tcp://<host2>:<port2>)?useExponentialBackOff=false&amp;maxReconnectDelay=3000"/>
</networkConnectors>

if you use one of the lastest versions of ActiveMQ.

Upvotes: 1

Matt Pavlovich
Matt Pavlovich

Reputation: 4306

Network Connectors imply 'failover'. You shouldn't use the failover: uri at all. Posta's article is outdated.

Upvotes: 0

Related Questions