@@ -59,6 +59,8 @@ to be used for all responses including the publications
5959*/
6060func InitConnection (qMgrName string , replyQ string , cc * ConnectionConfig ) error {
6161 var err error
62+ var errorString = ""
63+
6264 gocno := ibmmq .NewMQCNO ()
6365 gocsp := ibmmq .NewMQCSP ()
6466
@@ -80,6 +82,8 @@ func InitConnection(qMgrName string, replyQ string, cc *ConnectionConfig) error
8082 qMgr , err = ibmmq .Connx (qMgrName , gocno )
8183 if err == nil {
8284 qmgrConnected = true
85+ } else {
86+ errorString = "Cannot connect to queue manager " + qMgrName
8387 }
8488
8589 // Discover important information about the qmgr - its real name
@@ -109,6 +113,7 @@ func InitConnection(qMgrName string, replyQ string, cc *ConnectionConfig) error
109113 commandLevel = v [ibmmq .MQIA_COMMAND_LEVEL ].(int32 )
110114 if commandLevel < 900 && platform != ibmmq .MQPL_ZOS && platform != ibmmq .MQPL_APPLIANCE {
111115 err = fmt .Errorf ("Queue manager must be at least V9.0 for monitoring." )
116+ errorString = "Unsupported system"
112117 }
113118 }
114119 // Don't need the qMgrObject any more
@@ -130,6 +135,9 @@ func InitConnection(qMgrName string, replyQ string, cc *ConnectionConfig) error
130135 }
131136
132137 cmdQObj , err = qMgr .Open (mqod , openOptions )
138+ if err != nil {
139+ errorString = "Cannot open queue " + mqod .ObjectName
140+ }
133141
134142 }
135143
@@ -144,6 +152,8 @@ func InitConnection(qMgrName string, replyQ string, cc *ConnectionConfig) error
144152 replyQBaseName = replyQ
145153 if err == nil {
146154 queuesOpened = true
155+ } else {
156+ errorString = "Cannot open queue " + replyQ
147157 }
148158 }
149159
@@ -154,10 +164,13 @@ func InitConnection(qMgrName string, replyQ string, cc *ConnectionConfig) error
154164 mqod .ObjectType = ibmmq .MQOT_Q
155165 mqod .ObjectName = replyQ
156166 statusReplyQObj , err = qMgr .Open (mqod , openOptions )
167+ if err != nil {
168+ errorString = "Cannot open queue" + replyQ
169+ }
157170 }
158171
159172 if err != nil {
160- return fmt .Errorf ("Cannot access queue manager . Error: %v" , err )
173+ return fmt .Errorf (errorString + " . Error: %v" , err )
161174 }
162175
163176 return err
@@ -221,7 +234,7 @@ func getMessageWithHObj(wait bool, hObj ibmmq.MQObject) ([]byte, error) {
221234
222235 if wait {
223236 gmo .Options |= ibmmq .MQGMO_WAIT
224- gmo .WaitInterval = 10 * 1000
237+ gmo .WaitInterval = 30 * 1000
225238 }
226239
227240 datalen , err = hObj .Get (getmqmd , gmo , getBuffer )
@@ -277,8 +290,7 @@ func GetPlatform() int32 {
277290}
278291
279292/*
280- Return the current platform - the MQPL_* definition value. It
281- can be turned into a string if necessary via ibmmq.MQItoString("PL"...)
293+ Return the current command level
282294*/
283295func GetCommandLevel () int32 {
284296 return commandLevel
0 commit comments