I am using multiple <si:service-activator>
's and <jms:message-driven-channel-adapter>
's to subscribe to multiple queues and topics. Messages from each destination are received in a separate thread, which means that my receiving code is full of locks to guard the mutable internal state.
I would like my receiving code to be lock free. Is it possible to configure spring-integration/activemq to receive from multiple destinations on the same thread?
If this is not possible, I can think of two alternatives:
Start my own processing thread which reads from a blocking queue, put all received messages on this queue.
Dispatch all received messages onto a single destination and consume from this.
Anyone have any better ideas?
Use the wildcard pattern on a single queue.
That is, instead of reading from two queues, use one queue and specify all queues you want to read from in the name.
that is: "QUEUE.NR1,QUEUE.NR2"
or "SOME.PREFIX.>"
to read all queues with that prefix. Your client code handle this as a single queue.