0

I am trying to use MQ shared subscription, which is not working when I have multiple instances of my micro-service up and running.

My DefaultJmsListenerContainerFactory configuration is as mentioned below, where I am using factory.setSubscriptionShared(true).

  @Bean
  @Qualifier("subscriberListenerContainerFactory")
  public DefaultJmsListenerContainerFactory subscriberListenerContainerFactory(@Qualifier("subscriberConnectionFactory") ConnectionFactory subscriberConnectionFactory) {
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    factory.setConnectionFactory(subscriberConnectionFactory);
    factory.setDestinationResolver(new MyDestinationTopicResolver("Topic-JNDI-Name", "Topic-Name"));
    factory.setSubscriptionShared(true);
    factory.setPubSubDomain(true);
    factory.setSessionTransacted(true);
    factory.setSubscriptionDurable(true);
    factory.setConcurrency("1-1");
    return factory;
 }

My listener config is shown below:

@JmsListener(subscription = "My-Test-Subscription", destination = "dummy", containerFactory = "subscriberListenerContainerFactory", selector = "message_sub_type = 'MY_EVENT'")
public void onMessage(Message message) throws JAXBException { ... }

When I try to run multiple instances of this service, I get following error in all instances:

Caused by: com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '1' ('MQCC_WARNING') reason '2429' ('MQRC_SUBSCRIPTION_IN_USE')

I want to use shared subscription so that only one instance of the service gets the message from topic.

NOTE: Previously we had same subscription but it was not shared and not durable. Then we made it shared and durable. After that first time, it worked fine. Now when we are trying to change the subscription name or client id, we are getting above error. I understand that if it is durable subscription, then the subscription will be present in IBM MQ Server, and due to that, when we are trying to make any change in durable subscription, we are getting error: '2429' ('MQRC_SUBSCRIPTION_IN_USE'). But we are not able to see the durable subscription in MQ explorer, still we are getting MQRC_SUBSCRIPTION_IN_USE error.

Is there a possibility that the previous durable subscription is in some inconsistent state (like stale or uncommitted)?

7
  • 1
    What version of MQ are your IBM MQ jar files from?
    – JoshMc
    Mar 15 at 14:43
  • MQ version is 9.1.0.1 - @JoshMc Mar 16 at 3:00
  • 1
    Can you confirm the version of the jms.jar?
    – JoshMc
    Mar 16 at 6:35
  • javax.jms-api-2.0.1.jar spring-jms-5.3.25.jar Mar 16 at 6:39
  • ibm.mq.allclient-9.3.0.0.jar Mar 16 at 6:54

1 Answer 1

0

Please see Sharing Subscriptions.

1
  • This is just theoretical document, which I am already aware off. This does not help in solving the problem I am facing. Mar 17 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.