MQ

 View Only

 JNDI property to set the client connection timeout for MQ

Ravi Mergu's profile image
Ravi Mergu posted Tue May 27, 2025 08:28 AM

How can we set the connection timeout using a JNDI property for IBM MQ on the client side, similar to what is described in the Oracle JNDI documentation?



Paul Titheridge's profile image
Paul Titheridge

Hi Ravi,

When using the IBM MQ classes for JMS, you can specify a connection timeout by setting the Java system property com.ibm.mq.cfg.TCP.Connect_Timeout to a value in seconds. There are a few ways to do this:

1 ) One is to specify the argument -Dcom.ibm.mq.cfg.TCP.Connect_Timeout=<value> on the command line when starting the application.

2 ) An alternative approach is to set it programmatically inside an application. To do this, the following line needs to be added before the application does any JMS work:

System.setProperty("com.ibm.mq.cfg.TCP.Connect_Timeout", "<value>");

I hope this helps! If you have any additional questions, feel free to ask.

Thanks

Paul Titheridge

IBM MQ Development : Java Service