Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActiveMQ consumer groups on Pub/Sub topics

I'm quite new to the ActiveMQ and I would like to know if it's possible to setup for the following scenario:

Service A and B subscribe to a Pub/Sub topic. This topic I use for event sending, so the interested service can react on it.

Now, if I want to scale the service A, adding one more instance. How can I ensure that both instance won't process the same event? (Ending up create duplicated data).

Is it possible to achieve this in ActiveMQ? If yes, how?

Thanks.

like image 969
Vitor Villar Avatar asked Feb 11 '26 05:02

Vitor Villar


1 Answers

If you're using JMS then this scenario really needs shared topic subscriptions which were added in JMS 2.0. ActiveMQ 5.x doesn't support JMS 2, but ActiveMQ Artemis (the next generation ActiveMQ broker) does support JMS 2 so you should use that.

like image 169
Justin Bertram Avatar answered Feb 15 '26 21:02

Justin Bertram



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!