2232
我有以下代码来获取队列信息,当作为事务的一部分完成时会引发错误:
Dim specificQMConnProperties As Hashtable = CType(queueManagerConnectionProperties.Clone(), Hashtable)
specificQMConnProperties.Add(MQC.HOST_NAME_PROPERTY, qmgrHostNameOrIP)
specificQMConnProperties.Add(MQC.PORT_PROPERTY, qmgrPort)
specificQMConnProperties.Add(MQC.CHANNEL_PROPERTY, qmgrChannel)
Dim qmgr As MQQueueManager = Nothing
Try
qmgr = New MQQueueManager(qmgrName, specificQMConnProperties)
Catch ex As MQException
Select Case ex.ReasonCode
Case 2059, 2538
' qmgr or host not available
Return nothing
Case Else
' continue
End Select
End Try
If qmgr IsNot Nothing Then
Try
' use PCF to get queue information.
Dim agent As New PCFMessageAgent(qmgr)
Dim request As New PCFMessage(CMQCFC.MQCMD_INQUIRE_Q)
request.AddParameter(MQC.MQCA_Q_NAME, queueName)
Dim responses As PCFMessage() = Nothing
Try
' connected
responses = agent.Send(request)
Catch pcfex As PCFException
LogException(pcfex, {queue}, "Exception checking queue availability via PCF. Assuming false")
Return Nothing
End Try
If responses IsNot Nothing AndAlso responses.Any() Then
LogDebug("Checking queue availability for " & queue.ToString() & " returned a PCF result.")
return responses
Else
LogError("No result returned from PCF Message request on " & queue.ToString())
Return Nothing
End If
Catch ex As MQException
LogException(ex, {queue})
Return False
End Try
End If
错误出现在线路上responses = agent.Send(request)
,如下:
完成代码:2,原因代码:2232(2232=MQRC_UNIT_OF_WORK_NOT_STARTED) 在 IBM.WMQ.MQDestination.Put(MQMessage message, MQPutMessageOptions pmo) 在 IBM.WMQ.PCF.PCFAgent.Send(Int32 command, PCFParameter[] parameters) 在 IBM .WMQ.PCF.PCFMessageAgent.Send(PCFMessage request, Boolean check) at IBM.WMQ.PCF.PCFMessageAgent.Send(PCFMessage request) at MyMethod
我的其余事务连接选项(例如用于消息获取或放置)已Or MQC.MQGMO_SYNCPOINT
附加 - 但我看不到如何设置 PCF 消息的连接选项。有人可以帮忙吗?
需要明确的是,我并不关心它是否作为事务的一部分发送,但是因为 Transactionscope 是打开的,所以我收到了这个错误。
- 编辑 -
我在顶部添加了队列管理器连接的代码。