...
Code Block |
---|
java.naming.provider.url=failover:(tcp://172.18.7.4:61616?soTimeout=60000,tcp://172.18.7.5:61616?soTimeout=60000)?randomize=false&backup=true&trackMessages=true
|
You may add any number of AMQ instances you want in the failover/tcp chain. The soTimeout=60000 parameter prevents to keep too much useless connections opened. On the broker side you need to use transport.soTimeout=60000 in activemq.xml. Currently, the number of connections keep to increase. I hope to fix that soon... (see note below)
I tried to add &backup=true&trackMessages=true at the end of the failover chain (ie after ?randomize=false) but the connectionsd created are held and it seems there are no means to close them. It's weird, sot I asked on ActiveMQ user ML, no answers yet...
See Transport Options for details on the these 2 last parameters. There is a also a link at bottom of this page if ever you need to escalate more smoothly dynamic setting of failover. But it would need more work in OFBiz...
See
Notes
If you get a "Too many open files" error. In Unix like systems, Network connections are actually backed by files descriptors. So Edit /etc/security/limits.conf to increase nofile for the users running ActiveMQ. like
Code Block |
---|
user - nofile 10000
root - nofile 10000
|
While at it, I recommend also to increase the max heap used by ActiveMQ. For instance we increased ActiveMQ max heap to 512MB and 1GB respectively on stagging and production clusters from default 256MB, can't hurt...
...
Then you should not get issues with held connections or too many open connections
On the broker side (in activemq.xml) you need to
- set advisorySupport="false" for the broker (exceptif you want to use advisroy messages)
- use transport.soTimeout=60000 and set enableStatusMonitor="true" for Openwire connector
Code Block <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.base}/data" destroyApplicationContextOnStop="true" advisorySupport="false"> .... <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?transport.soTimeout=60000" enableStatusMonitor="true"/>
Some possible pitfalls
This section can be bypassed but might help in case of troubles
I first installed ActiveMQ 5.5.0 on my developement machine on XP. When I ran OFBiz I got this non blocking error
...