-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MQ Queue Manager Channel Name is disappearing form the JmsConnectionFactory when we use them across both JmsListener and JmsTemplate #70
Comments
I've got no real idea what's going on here. Your code doesn't compile (even when obvious variables like the qmgr and channel names are added) so it's rather difficult to know what you are trying to do. But I suspect that you are trying and not quite succeeding in bypassing the automatic connection configuration done by Spring Boot that sets defaults on connections when the CFs are created. Though you also say you are using v2.0.0 of the starter which is 3 years old, and all kinds of things have changed since then. |
I doubt very much that this is one long continuous method, but this is how you have written it. It makes it very hard to debug your code, as it appears that (even though you are on a back level version of the MQ Spring boot starter) your issue is in how you are making use of connection factory beans. Let me explain why its difficult to debug your code - You initialise a CachingConnectionFactory as You base your JmsTemplate on JmsTemplate loJmsTemplate = new JmsTemplate(loCachingConnectionFactory); and you base your JmsListenerContainerFactory on DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
factory.setConnectionFactory(aCachingConnectionFactory); I would expect you to be using syntax similar to the configurations, components and beans defined in this sample - https://github.com/ibm-messaging/mq-dev-patterns/tree/master/Spring-JMS/src/main/java/com/ibm/mq/samples/jms/spring/level114 |
Hello Mark, Many thanks for your review and suggestions, I haven't pasted the full code in my previous post because I thought just a sample template would suffice. I have attached my full code here and it will help you to understand what we are trying to implement. I have upgraded the version to latest (2.4.2) as well. Regards, package com.rbs.bdd.mq.clustered.framework.config; import java.io.InputStream; import javax.jms.JMSException; import org.bouncycastle.jce.provider.BouncyCastleProvider; import com.ibm.mq.jms.MQQueueConnectionFactory;
} |
**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?**
The text was updated successfully, but these errors were encountered: