|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Getting JMSWMQ2011 when using durable subscriptions |
« View previous topic :: View next topic » |
Author |
Message
|
mdhuper |
Posted: Wed Aug 06, 2014 12:27 pm Post subject: Getting JMSWMQ2011 when using durable subscriptions |
|
|
Newbie
Joined: 06 Aug 2014 Posts: 3
|
Hi All,
We are trying to set up Publish/Subscribe with WMQ using JBoss. Everything works fine when using a single instance of JBoss. However when we run another instance(a cluster), we keep getting this error
Cause: JMSWMQ2011: Failed to open durable subscription
This error comes from spring JMS. We have durable subscriptions in both the instances with same clientID and subscriptionName. My initial thought is that I am missing some specific configuration either in application server or in WMQ.
Here are the configurations I am using
Code: |
<connection-definitions>
<connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/jms/MQ_CONNECTION_FACTORY" pool-name="MQ_CONNECTION_FACTORY">
<config-property name="port">
1414
</config-property>
<config-property name="hostName">
localhost
</config-property>
<config-property name="userName">
MUSR_MQADMIN
</config-property>
<config-property name="clientId">
sampleSubscribeService
</config-property>
<config-property name="cloneSupport">
enabled
</config-property>
<config-property name="transportType">
CLIENT
</config-property>
<config-property name="queueManager">
MQ
</config-property>
</connection-definition>
</connection-definitions>
|
Here is the spring configuration
Code: |
<bean id="jmsListenerContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer"
scope="prototype" autowire="byType" lazy-init="true">
<property name="connectionFactory" ref="jmsConnectionFactory" />
<property name="destination" ref="cfQueue" />
<property name="destinationResolver" ref="jmsDestinationResolver" />
And here is the Java snippet
|
Code: |
for (int i = 0; i < beanIds.length; i++) {
final String subscriptionName = ndc.getDestinationName() + i;
if (listenerAlreadyCreated(subscriptionName, beanIds[i].trim())) {
continue;
} else {
jmsQueueMessageListener = (JMSNotificationMessageListener) applicationContext
.getBean("jmsMessageListener");
jmsQueueMessageListener
.setNotificationReceiver((NotificationServiceReceiver) applicationContext
.getBean(beanIds[i].trim()));
final DefaultMessageListenerContainer jmsListenerContainer = applicationContext
.getBean(DefaultMessageListenerContainer.class);
// jmsListenerContainer.setConnectionFactory(jmsConnectionFactory);
jmsListenerContainer.setClientId("sampleSubscribeService");
jmsListenerContainer
.setDurableSubscriptionName(subscriptionName);
jmsListenerContainer
.setDestinationName((String) destinationObject);
jmsListenerContainer.setSubscriptionDurable(true);
jmsListenerContainer
.setDestinationName((String) destinationObject);
jmsListenerContainer.setPubSubDomain(true);
jmsListenerContainer
.setMessageListener(jmsQueueMessageListener);
jmsListenerContainer.start();
}
}
|
Are these configurations correct ?
Any suggestion is much appreciated |
|
Back to top |
|
 |
mdhuper |
Posted: Mon Aug 11, 2014 1:30 am Post subject: |
|
|
Newbie
Joined: 06 Aug 2014 Posts: 3
|
Does anyone have any suggestions or any ideas ? |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Aug 11, 2014 6:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
When you created the subscription, did you set it up as shared?
What is your goal there?
- Each instance of JBoss get's its own copy of the publication
- All instances of JBoss share in consuming a single copy of the publication
If you are gunning for the first case, each instance of JBoss should have a different clientId (and subscription). Also you might want to limit the clientId to 12 bytes.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mdhuper |
Posted: Tue Aug 12, 2014 1:59 am Post subject: |
|
|
Newbie
Joined: 06 Aug 2014 Posts: 3
|
Thanks for the reply. My use case is for second approach. I have not set subscription as shared. I am using spring to create the listeners and I could not find an option to do that programmatically. Is that the absolutely necessary thing I must do ? |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|