Question

We have two JEE6 apps that we're getting ready to deploy. Part of the app will run out the cloud and produce messages to a JMS Queue. The other half of the app will run on our servers and consume the messages from the JMS Queue. Both parts of the app run as separate wars and are deployed to Apache TomEE 1.6 (which is awesome btw) and are written using latest JEE and CDI specs.

Message durability is our main concern, but we are willing to make the assumption that the cloud application will have 100% up time and deal with the exception cases by hand. The local app will be restarted frequently, as we are improving it's design and making a lot of changes.

After reading the ActiveMQ documentation, I'm pretty sure what we want is a store-and-forward architecture. What's a little hazy with their documentation is how the properties http://activemq.apache.org/vm-transport-reference.html translate to creating this sort of architecture.

The final challenge is the local broker needs to be very fast. Not only will it consume messages off the remote queue, it has several queues it writes and reads locally. Fortunately, any queues produced on the local broker don't need to be consumed anywhere but locally. The messages must be durable though. ...and if I manage to do that, I need to figure out how to run bi-directional SSL!!

The TLDR is I two things: example URL configurations to get me started, or advice on what options in ActiveMQ would be better than what I've said above. Thank you!

Was it helpful?

Solution

After 8 hours of grueling experimentation, it turns out this isn't that difficult. It's just documented or very clear... and I had ipv6 get enabled on one of the hosts which caused all sorts of problems.

On the "cloud" server, you'll use this

<Resource
    id="MyJmsResourceAdapter"
    type="ActiveMQResourceAdapter">
    BrokerXmlConfig = broker:(tcp://0.0.0.0:61617,network:static:tcp://ground.server.com:61617)?persistent=false
    ServerUrl = vm://localhost 
</Resource>

On your "ground" server,

<Resource
    id="MyJmsResourceAdapter"
    type="ActiveMQResourceAdapter">
    BrokerXmlConfig = broker:(tcp://0.0.0.0:61617,network:static:tcp://cloud.server.com:61617)?persistent=false
    ServerUrl = vm://localhost 
</Resource>

Finally, disable ipv6 in your JAVA_OPTS in Apache TomEE. You can do this by creating a setenv.sh in bin/ and putting the following:

export JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"

Now... to figure out SSL. Hope this helps someone!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top