I have the following code to get queue information, which throws a 2232
error when done as part of a transaction:
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
The error occurs on the line responses = agent.Send(request)
, as follows:
Completion Code: 2, Reason Code: 2232(2232=MQRC_UNIT_OF_WORK_NOT_STARTED) at IBM.WMQ.MQDestination.Put(MQMessage message, MQPutMessageOptions pmo) at IBM.WMQ.PCF.PCFAgent.Send(Int32 command, PCFParameter[] parameters) at IBM.WMQ.PCF.PCFMessageAgent.Send(PCFMessage request, Boolean check) at IBM.WMQ.PCF.PCFMessageAgent.Send(PCFMessage request) at MyMethod
The rest of my transaction connection options (e.g. for message get or put) have Or MQC.MQGMO_SYNCPOINT
appended - but I can't see how to set the connection options for a PCF message. Can anyone assist?
To be clear, I don't really care if it is sent as part of the transaction, but because a Transactionscope is open, I get this error.
--Edit--
I've added the code for the queue manager connection at the top.
get
,PCF
,put here
orput there
; for example. – simonalexander2005