Ian Cox
Ian Cox

Reputation: 31

Apache Camel with ActiveMQ Artemis Cluster and JTA

I currently have an active/passive ActiveMQ Classic setup. There is 1 node in each DC (2 DC's), and I regularly swap nodes. We are using a database to act as shared storage.

I want to move to ActiveMQ Artemis multi-node cluster with all nodes active, and load balancing across the 2 DC's resulting in a more resilient solution. Therefore I have set up the cluster using 6 live only nodes using ON_DEMAND to enable the load balancing and for the services that are modeled on using the outbox pattern where the double write problem is solved. I have no issues.

The problem is the Spring Boot services based on Camel routes. Typically these are from a queue, through a processor that updates the database, and on to another queue. Some split or multicast on the output as well.

I currently have the Camel route transacted but using a ChainedTransactionManager. This is configured to have 2 ActiveMQ components - consumer and producer with their own JMSTransactionMananger and a DatasourceTransactionMananger to handle the database. This setup is fine apart from the fact that the chained manager is now deprecated. Looking at the various articles and Camel in Action it's clear I should really move to JTA. Now starts the problem.

With JTA implemented (Narayana library) performance drops as the transaction is actioned by closing the current JMS session. This is fine however when the Camel route restarts the listener it causes the connection to move to a different node and because of the ON_DEMAND setting in Artemis the data has to follow. Some queues can hit several thousand entries at peak because they are fed by a batch process.

How can I 'pin' the session connection to the same server and avoid this.

Tried adding an ActiveMQ Artemis connection router, but I cannot find any pattern that could allow both service styles to work. JMS and database connection pooling is enabled using the Narayana messagehub enabled=true.

Upvotes: 0

Views: 123

Answers (0)

Related Questions