I have a module which runs standalone in a JVM
(no containers) and communicates with other modules via JMS
.
My module is both a producer in one queue and a consumer in a different queue.
I have then need to cluster this module, both for HA reasons and for workload reasons, and I'm probably going to go with Terracotta+Hibernate for clustering my entities.
Currently when my app starts it launches a thread (via Executors.newSingleThreadExecutor()
) which serves as the consumer (I can attach actual code sample if relevant and neccessary).
What I understood from reading questions here is that if I just start up my module on N
different JVMs
then N
different subscribers will be created and each message in the queue will arrive to N
subscribers.
What I'd like to do is have only one of them (let's currently say that which one is not important) process that message and so in actuality enable me to process N
messages at a time.
How can/should this be done? Am I way off the track?
BTW, I'm using OpenMQ
as my implementation but I don't know if that's relevant.
Thanks for any help