There is MQGMO_WAIT option and a WaitInterval that can be set to make the Get call to wait for a certain amount of time. For example, the following snippet makes the Get call to wait for 3 seconds.
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.Options = MQConstants.MQGMO_WAIT;
gmo.WaitInterval = 3000;
mqQueue.Get(mqMessage, gmo);
There is no option to set a timeout for the Put call though. The Put call returns with an error if there is any issue.
UPDATE:
When a Put call is invoked, connection to queue manager is already established. If there are any issues with the connection, the Put call gets returns soon as the TCP stack notifies of such issue. As such TCP level issues affect the all applications running on the system, in my opinion, tuning must be done at the system level and not at a per application level. Also I don't think it's possible to set a timeout for a socket.write call.
MQ does provide a way set a timeout for establishing connection to queue manager though. There is connection_timeout parameter in mqclient.ini you can set a timeout.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…