Reputation: 51
I am a java developer. I have created the Queue connection factories and Queues in WAS 8.0.0.10 in order to connect to IBM MQ. I want to test the timeout scenario, hence, i purposely shut down the IBM MQ. It took about 2-3 minutes to get the expected timeout result. I want to decrease the value of timeout, however, i could not find any configuration in there.
May i know is there possible to configure the timeout value? Because i try out almost all the timeout configuration, but none of them helps. Thank you.
Upvotes: 5
Views: 2927
Reputation: 10652
It depends on which TIMEOUT you are trying to configure.
The TCP Connection Timeout for an initial connection can be configured by setting the Connect_Timeout
value to the number of seconds you want the connection to wait for an initial TCP connection. This would apply for instance if the server was down, or a network connection to the server was down. If the server was up and reachable over the network and only the MQ listener (or all of MQ) was shutdown then the response from the server to a connection to the MQ listener port would be an immediate "Connection refused" and you would never hit the TCP Connection Timeout.
You can set Connect_Timeout
in various ways, two of which are:
mqclient.ini file (see Location of the client configuration file) in the TCP stanza, for example:
TCP:
Connect_Timeout=30
Passing a java system property equivalent to the above, for example:
-Dcom.ibm.mq.cfg.TCP.Connect_Timeout=30
If you are looking for how to set the timeout of a existing connection to MQ there are a few things to note:
IBM MQ clients/queue managers by default send heartbeat messages when a channel is idle. The HBINT
of the SVRCONN
channel will define the interval in seconds at which a heart beat message is sent if no other traffic has passed over the channel for JMS MQ clients.
Normally the client should always initiate the HB and the queue manager will respond. If the queue manager does not receive a HB request in HBINT
+5 seconds it will initiate a HB to the client and expect a response.
The timeout is based upon 2*HBINT
for HBINT
's of less than 60 seconds and HBINT
+ 60 for HBINT
's of over 60 seconds. The default HBINT
on a SVRCONN
is 300 so the TIMEOUT of a MQ connection to a channel with the default HBINT
would be 360 seconds. You mention 2 - 3 minutes I suspect if you timed it on a watch it would be 6 minutes.
If you wanted to set the timeout to 30 seconds then you would alter the SVRCONN
channels HBINT
to 15 seconds, for example:
ALTER CHL(CHL.NAME) CHLTYPE(SVRCONN) HBINT(15)
Note that the value only takes effect the next time you make a client connection to the channel, it would not impact the HBINT of already running channels.
Additional note that when connecting to MQ queue managers v6 or older, client HB messages are only sent when the client is in a GET with WAIT operation, not at other times.
Upvotes: 3