How to configure AMQ connection between inner and outer network
Environment
- Red Hat AMQ
- 6.3
Issue
I have two AMQ environments. One is located in the inner network (10.x.x.x), another is located in the outer network (192.x.x.x). We have network devices to transform the IP address between inner and outer network. I want messages to traverse from both sides bidirectionally.
Resolution
Suppose the IP transformation is like this:
Inner AMQ (HA):
Primary: 10.0.0.1 -> 192.168.0.1
Standby: 10.0.0.2 -> 192.168.0.2
Outer AMQ (HA):
Primary: 192.168.1.1 -> 10.0.1.1
Standby: 192.168.1.2 -> 10.0.1.2
In the inner AMQ activemq.xml configuration file:
<networkConnectors>
<networkConnector uri="static:(tcp://192.168.1.1:61616,tcp://192.168.1.2:61616)" duplex="true"/>
</networkConnectors>
Root Cause
When AMQ instances are deployed to cross-network communication, configure the outer AMQ IP address in the inner AMQ configuration file.
In the outer AMQ configuration, it is not necessary to configure any explicit networkConnectors.
The duplex="true" tag is mandatory because it is used to produce and to consume messages on both sides. This is useful for hub and spoke scenarios when the hub is behind a firewall. If one side of AMQ does not connect to the other side (one-way connection), remove duplex="true".
If there are issues about amq shutting down NC, please reference this article to replace static with masterslave for a master/slave configuration.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments