This question is similar to the one here, but I'm not sure how to get this working
I have an ActiveMQ Artemis Broker v 2.16.0 and Spring microservice projects with spring-jms 5.3.3. I have two microservices, A and B, that subscribe to a topic. Because of high workload, I have two instances of microservice A running. How can I configure both instances of microservice A to connect to the topic but not consume the same messages?
Generally speaking, every JMS topic subscriber gets every message sent to the topic. However, JMS 2 introduced the concept of a "shared" subscription where 2 subscribers share the same subscription so only one of them will get any particular message. You need to invoke setSubscriptionShared(true)
when you configure your JMS listener container factory in order to enable this behavior.