0
votes

Good day everyone.

1) I have a simple app which creates JMSProducer, ActiveMQ Query and send some messages to query.

2) I also have the application which is a subscriber of ActiveMQ Query (it receives messages from application above).

This is the situation:

I create another server config to my subscriber-App, and launch it twice at a time on different ports. (for example: subscriber-App1 started at jetty-http-port-9998/jetty-ssl-port-9994; subscriber-App2 started at jetty-http-port-9999/jetty-ssl-port-9995).

I open subscriber-App1 console and subscriber-App2 console at Intellij IDEa and begin to send messages by producer-App. And I see that subscribers takes messages by rotation: when I send it the first time - subscriber1 takes it; 2nd time - subscriber2; 3rd time - subscriber1 etc.

The question is: how can I configure subscriber-Application to give it exclusive access to data? The main condition is: if there is the one Subscriber of my Queue - another applications can't receive messages from Queue. And if I launch two subscriberApps on different ports - all messages will be received by only one of them.

Thank you in advance!

1
It is not clear what you are trying to achieve? If you want to make sure just "your" consumer ("subscriber" is more of a pub-sub, i.e. topic related, term) attaches to the queue, then just secure the broker. If you want to make sure there is only 1 instance of your consumer it gets trickier. Can you clarify what you are trying to achieve?sceaj

1 Answers

0
votes

I believe you should be able to use the exclusive consumer feature to achieve your goal.