Skip to content

MQ Queue Manager Channel Name is disappearing form the JmsConnectionFactory when we use them across both JmsListener and JmsTemplate #70

Open
@litheshgopal

Description

@litheshgopal

**MQ Queue Manager Channel Name is disappearing form the JmsConnectionFactory when we use them across both JmsListener and JmsTemplate

Spring JMS - mq-jms-spring-boot-starter (Version 2.0.0)
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)

MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();
mqQueueConnectionFactory.setHostName(lsHost);
mqQueueConnectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
mqQueueConnectionFactory.setChannel(lsChannel);
mqQueueConnectionFactory.setPort(loPort);
mqQueueConnectionFactory.setQueueManager(lsManager);
mqQueueConnectionFactory.setPollingInterval(loPollingInterval);
mqQueueConnectionFactory.setSSLSocketFactory(loSSLSocketFactory);
mqQueueConnectionFactory.setSSLFipsRequired(false);
mqQueueConnectionFactory.setSSLCipherSuite(lsSslCipherSuite);
mqQueueConnectionFactory.setSSLPeerName(lsSslPeerName);

CachingConnectionFactory loCacheConnFactory = new CachingConnectionFactory();
loCacheConnFactory.setTargetConnectionFactory(mqQueueConnectionFactory);
loCacheConnFactory.setSessionCacheSize(loCacheSize);
loCacheConnFactory.setCacheConsumers(true);
loCacheConnFactory.setReconnectOnException(true);

JmsTransactionManager loJmsTransactionManager = new JmsTransactionManager(loCachingConnectionFactory);

JmsTemplate loJmsTemplate = new JmsTemplate(loCachingConnectionFactory);
loJmsTemplate.setPubSubDomain(false);
loJmsTemplate.setDeliveryPersistent(true);
loJmsTemplate.setReceiveTimeout(loTimeOut);
loJmsTemplate.setSessionTransacted(true);

DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
factory.setConnectionFactory(aCachingConnectionFactory);
factory.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER);
factory.setConcurrency("1-5");
factory.setSessionTransacted(lbSessionTranscated);
factory.setAutoStartup(true);
factory.setReceiveTimeout(loTimeOut);
factory.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER);
factory.setTransactionManager(loJmsTransactionManager);

SimpleJmsListenerEndpoint loEndPoint = new SimpleJmsListenerEndpoint();
loEndPoint.setMessageListener(loMessageListenerInstance);
loEndPoint.setDestination(lsQueueName);

DefaultMessageListenerContainer loListenerContainer = factory.
createListenerContainer(loEndPoint);

loListenerContainer.setMaxConcurrentConsumers(loMaxConcurrentConsumer);
loListenerContainer.setConcurrentConsumers(loConcurrentConsumer);
loListenerContainer.setIdleTaskExecutionLimit(loIdleTaskExeLimit);
loListenerContainer.setMaxMessagesPerTask(loMaxMsgPerTask);
loListenerContainer.setIdleConsumerLimit(loIdleConsumerLimit);
loListenerContainer.setAcceptMessagesWhileStopping(false);

loJmsTemplate.send(aQueueName, MessageCreator);

2021-06-10T12:32:06.016+01:00 [APP/PROC/WEB/0] [ERR] org.springframework.transaction.CannotCreateTransactionException: Could not create JMS transaction; nested exception is com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: Failed to connect to queue manager '' with connection mode 'Client' and host name 'RBSMQ-RS861AC.server.rbsgrp.net(5111)'.
2021-06-10T12:32:06.016+01:00 [APP/PROC/WEB/0] [ERR] Check the queue manager is started and if running in client mode, check there is a listener running. Please see the linked exception for more information.
2021-06-10T12:32:06.016+01:00 [APP/PROC/WEB/0] [ERR] at org.springframework.jms.connection.JmsTransactionManager.doBegin(JmsTransactionManager.java:234)
2021-06-10T12:32:06.016+01:00 [APP/PROC/WEB/0] [ERR] at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:378)
2021-06-10T12:32:06.016+01:00 [APP/PROC/WEB/0] [ERR] at com.rbs.bdd.mq.clustered.framework.message.sender.impl.ClusteredMessageSenderImpl.sendMessageToQueue(ClusteredMessageSenderImpl.java:128)
2021-06-10T12:32:06.016+01:00 [APP/PROC/WEB/0] [ERR] at com.rbs.bdd.mq.clustered.framework.message.sender.impl.ClusteredMessageSenderImpl.sendMessage(ClusteredMessageSenderImpl.java:73)
2021-06-10T12:32:06.016+01:00 [APP/PROC/WEB/0] [ERR] at com.rbs.bdd.mq.clustered.framework.message.sender.impl.ClusteredVanquishTextMessageSenderImpl.dispatchMessage(ClusteredVanquishTextMessageSenderImpl.java:42)
2021-06-10T12:32:06.016+01:00 [APP/PROC/WEB/0] [ERR] at com.rbs.bdd.api.service.InwardRetrieveServiceImpl.sendMessageToClusteredQueue(InwardRetrieveServiceImpl.java:97)
2021-06-10T12:32:06.017+01:00 [APP/PROC/WEB/0] [ERR] at com.rbs.bdd.api.service.InwardRetrieveServiceImpl.processRetrieveRequest(InwardRetrieveServiceImpl.java:80)
2021-06-10T12:32:06.017+01:00 [APP/PROC/WEB/0] [ERR] at com.rbs.bdd.api.controller.InwardPaymentController.processRetrieveRequest(InwardPaymentController.java:53)
2021-06-10T12:32:06.017+01:00 [APP/PROC/WEB/0] [ERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2021-06-10T12:32:06.017+01:00 [APP/PROC/WEB/0] [ERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2021-06-10T12:32:06.017+01:00 [APP/PROC/WEB/0] [ERR] at

When we explicitly set mqQueueConnectionFactory.setChannel(lsChannel); before loJmsTemplate.send(aQueueName, MessageCreator); thing are working as expected! Not sure why channel is Vanished from the pre-configured ConnectionFactory object?**

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions