Reputation: 151
I'm facing difficulty in finding a solution where my listener code in activemq should listen messages from multiple brokers. For an example: we have 4 brokers(1,2,3,4) which serves messages to consumers which is hosted in 4 servers (A,B,C,D). The consumerA should listen for response messages from broker1,2,3 & 4. If its finds the message, then consumerA should pick and process the message. If in case consumerA is down for any reason consumerB should listen to all 4 brokers.
Configuring failover transport in below way doesn't help me to achieve above design.
activemq.broker.url=failover:(tcp://localhost:61716,tcp://localhost:61717,tcp://localhost:61718,tcp://localhost:61719)?randomize=false,timeout=5000,maxReconnectAttempts=3
With above uri configuration my listener code only listens to broker on port 61716 and if the message is available on another broker say on port 61717 its not able to pick and process it. Any help will be really appreciated.
P.S: Is there any example for one consumer listening to multiple brokers at the same time?
Upvotes: 1
Views: 1705
Reputation: 151
As i'm not finding a solution from activemq for one consumer listening to multiple brokers, we have implemented a solution of creating multiple beans each pointing to one specific broker url. That way we are pointing to 4 urls from same server and from same listener configuration file.
Upvotes: 1