@@ -41,6 +41,7 @@ import (
4141
4242var qMgrObject ibmmq.MQObject
4343var qObject ibmmq.MQObject
44+ var mh ibmmq.MQMessageHandle
4445
4546var ok = true
4647
@@ -50,7 +51,7 @@ func main() {
5051}
5152
5253// This is the callback function invoked when a message arrives on the queue.
53- func cb (hObj * ibmmq.MQObject , md * ibmmq.MQMD , gmo * ibmmq.MQGMO , buffer []byte , cbc * ibmmq.MQCBC , err * ibmmq.MQReturn ) {
54+ func cb (hConn * ibmmq. MQQueueManager , hObj * ibmmq.MQObject , md * ibmmq.MQMD , gmo * ibmmq.MQGMO , buffer []byte , cbc * ibmmq.MQCBC , err * ibmmq.MQReturn ) {
5455 buflen := len (buffer )
5556 if err .MQCC != ibmmq .MQCC_OK {
5657 fmt .Println (err )
@@ -113,6 +114,11 @@ func mainWithRc() int {
113114 }
114115 }
115116
117+ if err == nil {
118+ cmho := ibmmq .NewMQCMHO ()
119+ mh , err = qMgrObject .CrtMH (cmho )
120+ }
121+
116122 if err == nil {
117123 // The GET/MQCB requires control structures, the Message Descriptor (MQMD)
118124 // and Get Options (MQGMO). Create those with default values.
@@ -128,6 +134,9 @@ func mainWithRc() int {
128134 gmo .Options |= ibmmq .MQGMO_WAIT
129135 gmo .WaitInterval = 3 * 1000 // The WaitInterval is in milliseconds
130136
137+ gmo .Options |= ibmmq .MQGMO_PROPERTIES_IN_HANDLE
138+ gmo .MsgHandle = mh
139+
131140 // The MQCBD structure is used to specify the function to be invoked
132141 // when a message arrives on a queue
133142 cbd := ibmmq .NewMQCBD ()
0 commit comments