Vitor Villar
Vitor Villar

Reputation: 1925

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.

Upvotes: 3

Views: 1747

Answers (2)

Matt Pavlovich
Matt Pavlovich

Reputation: 4306

Vitor Villar you can also use Virtual Topics in ActiveMQ 5.x Virtual Topics are effectively the holy grail of messaging-- you publish to a topic and consume from queues.

  1. Producers and consumers are not linked to the same address (queue or topic name)
  2. Consumers can use all consuming patterns-- multi-threaded, active-standby, and message groups

ref: Virtual Topic

Upvotes: 1

Justin Bertram
Justin Bertram

Reputation: 34998

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.

Upvotes: 2

Related Questions