c# - How do I auto-connect IBM MQ client? -
i using mq.net classes of mq 7x client, , importing , exporting messages works fine. however, if there network disconnect or remote manager disconnected, ibm mq client doesn't automatically reconnect. get:
error: remote host ' not available, retry later. is there way auto-connect , continue processing message when these kind of issues occur?
there property check connection of queue manager:
mqqmgr = new mqqueuemanager("my queue manager name" ,"my channel name",",my connection name"); mqqmgr.isconnected returns true/false, doesn't auto-connect.
this using:
// mq properties hashtable properties = new hashtable(); properties.add(mqc.transport_property, mqc.transport_mqseries_managed); properties.add(mqc.connection_name_property, "connectionname"); properties.add(mqc.channel_property, "channelname"); properties.add(mqc.connect_options_property, mqc.mqcno_reconnect_q_mgr); mqqmgr = new mqqueuemanager("my queue manager"), properties); //error thrown i error on above line
ibm mqexception caught in send message - reason code - 2046- message -compcode: 2, reason: 2046 {"mqrc_options_error"} base {system.applicationexception}: {"mqrc_options_error"} compcode: 2 completioncode: 2 message: "mqrc_options_error" reason: 2046
automatic client reconnection supported mq c# client v7.1 onwards. have use mqcno_reconnect or mqcno_reconnect_q_mgr or mqcno_reconnect_as_def cno option enable automatic reconnection. mq v7.1 ships couple of samples, simpleclientautoreconnectput.cs 1 of them. please refer sample detail.
simple snippet.
mqqmgr = new mqqueuemanager("qm", mqc.mqcno_reconnect,"svrconnchn","localhost(1414)");
Comments
Post a Comment