Closed JanICT closed 11 months ago
There's not a lot I can do through this repo about the core MQ JMS client behaviour (or indeed the base Spring JMS Listener behaviour). So you might need to open a support case with IBM to discuss client timeouts.
But one question would be how the SVRCONN is configured on the queue manager - what's the SHARECNV value?
If it's zero, then there's no heartbeating going on between client and server, and broken connections are detected only when there's a real operation waiting to complete and timeouts are typically based on system TCP configuration
Non-zero values of SHARECNV do setup heartbeats based on the HBINT value.
The SHARECNV value is 10 and HBINT is 300 (seconds). I found out another department in the company faced the same problem and their advice was to set the property com.ibm.mq.cfg.MQRCVBLKTO. When I looked into com.ibm.mq.jmqi.internal.Configuration I saw more options to configure. I added the following static block to our configuration class:
@Configuration
@EnableJms
@EnableTransactionManagement
public class JmsConfig {
static {
System.setProperty("com.ibm.mq.cfg.MQRCVBLKTO", "5");
System.setProperty("com.ibm.mq.cfg.TCP.Connect_Timeout", "5");
System.setProperty("com.ibm.mq.cfg.TCP.KeepAlive", "YES");
}
@Bean
public JmsListenerContainerFactory<DefaultMessageListenerContainer> jmsListenerContainerFactory(ConnectionFactory connectionFactory,
PlatformTransactionManager transactionManager) {
...........
We hope these settings resolves the issue.
Using spring-boot 2.6.4 with mq-jms-spring-boot-starter 2.6.4 with Zulu Java 11
I have created a simple test application that listens to one queue.
with the following JmsConfig
and with the following application.properties
When I use sniffy (https://sniffy.io/) to close the connection to the queuemanager with a delay of 300000ms (5 min) the application enters some kind of sleep mode. It just waits until the 30000ms is reached. I am also unable to shutdown the application. It just keeps waiting.
The reason I tried this is that we experience the same problems in our production environment when the systems and networks are being updated. The connection to the queue manager is lost and no messages are picked up from the queue manager. The application will not respond anymore and looks like it entered a sleep mode. A graceful restart does not work, we see the same behavior as described above.
It looks like that the JmsPoolConnectionFactory does not listen to a timeout or something but just waits until the connection is closed.
Example logging with ibm.mq.pool.enabled=true and spring.jms.cache.enabled=false At 15:05:12.838 I close the connection. Then I do a shutdown. The shutdown will hang until the timeout of 300000ms is reached, which is on 15:10:12.815, exactly 5 min later.