-
Notifications
You must be signed in to change notification settings - Fork 63
Description
MQ v 9.1.2
go version go1.13.3 windows/amd64
I am trying to setup handling of qmgr ending or failing over and played around with setting up an MQCBT_EVENT_HANDLER to catch those events. When using MQCNO_RECONNECT and testing with endmqm -r it got a bit weird.
To reproduce I make these small adjustments to the amqscb.go sample code.
cno.Options = ibmmq.MQCNO_CLIENT_BINDING + ibmmq.MQCNO_RECONNECT
//and what else is necessary for Connx client binding.
cbd.CallbackType = ibmmq.MQCBT_EVENT_HANDLER
//callback function changed to this
func cb(hConn *ibmmq.MQQueueManager //.... same arguments as original
if err.MQCC != ibmmq.MQCC_OK {
fmt.Println(err)
ok = false
}
}
Also adding to mqclient.ini for quick abortion of reconnection
Channels: MQReconnectTimeout=15
Running this and ending qmgr with -r option results in this output.
Sample AMQSCB.GO start
Connected to queue manager QM1
Opened queue DEV.QUEUE.1
MQCALLBACK: MQCC = MQCC_WARNING [1] MQRC = MQRC_RECONNECTING [2544]
MQCALLBACK: MQCC = MQCC_WARNING [1] MQRC = MQRC_RECONNECTING [2544]
MQCALLBACK: MQCC = MQCC_WARNING [1] MQRC = MQRC_RECONNECTING [2544]
MQCALLBACK: MQCC = MQCC_WARNING [1] MQRC = MQRC_RECONNECTING [2544]
MQCALLBACK: MQCC = MQCC_WARNING [1] MQRC = MQRC_RECONNECTING [2544]
MQCALLBACK: MQCC = MQCC_FAILED [2] MQRC = MQRC_RECONNECT_FAILED [2548]
MQCALLBACK: MQCC = MQCC_FAILED [2] MQRC = MQRC_CONNECTION_BROKEN [2009]
MQCLOSE: MQCC = MQCC_FAILED [2] MQRC = MQRC_HCONN_ASYNC_ACTIVE [2500]
MQCALLBACK: MQCC = MQCC_WARNING [1] MQRC = MQRC_RECONNECTING [2544]
MQCALLBACK: MQCC = MQCC_WARNING [1] MQRC = MQRC_RECONNECTING [2544]
MQCALLBACK: MQCC = MQCC_WARNING [1] MQRC = MQRC_RECONNECTING [2544]
MQCALLBACK: MQCC = MQCC_WARNING [1] MQRC = MQRC_RECONNECTING [2544]
MQCALLBACK: MQCC = MQCC_FAILED [2] MQRC = MQRC_RECONNECT_FAILED [2548]
MQDISC: MQCC = MQCC_FAILED [2] MQRC = MQRC_RECONNECT_FAILED [2548]
This seems a bit weird since the MQ lib starts the reconnect procedure once more for the MQDISC call. Regardless since all CTL/Close/Disc call fails the cb function won't get cleared from the cbMap which doesn't feel right for a long running program that might reconnect later.
What is a proper programmer response to a MQRC_RECONNECT_FAILED [2548]?
Do we need another way of clearing the cb function(s) since all MQI calls fail?