preston.m.price
preston.m.price

Reputation: 666

How to limit number of consumers on an ActiveMQ JMS queue

We are using ActiveMQ and we're looking for a way to enforce a single-consumer policy for some of our JMS Queues. I've spent some time Googling but I can't find any way to limit the number of consumers on a queue.

Either of the following would be good solutions for us:

Thanks

Upvotes: 1

Views: 2578

Answers (1)

Petter Nordlander
Petter Nordlander

Reputation: 22279

There is no setting on broker side to enforce such a thing. You can, however, in all clients use the exclusive consumer option. That would allow all consumers to connect, but only one will actually get all messages until it drops out and a new exclusive consumer is chosen.

If you intend to host some sort of AMQ cloud service and really want to ensure applications out of your control behave according to SLA then you have to do some coding. You can implement ActiveMQ plugins.

If you implement a plugin and create a BrokerFilter then you can override the `addConsumer? method. Take a look at the RuntimeConfigurationPlugin to see how to setup the plugin.

Please not that implementing a plugin is not an easy admin tweak but requires some work.

Upvotes: 1

Related Questions