我正在构建一个将消息放入队列并将响应/回复放入另一个(通常是存根队列)的工具
一切正常,但似乎收到回复消息并放入存根队列所需的时间比实际时间长。`
Try
PublicMQVariable.MQMessage_Reply = New MQMessage
PublicMQVariable.MQMessage_Reply.CorrelationId = PublicMQVariable.MQMessage_Request.MessageId
PublicMQVariable.MQMessage_Reply.MessageType = MQC.MQMT_REPLY
PublicMQVariable.MQGetMessageOptions_Response = New MQGetMessageOptions
PublicMQVariable.MQGetMessageOptions_Response.Options = MQC.MQGMO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING
PublicMQVariable.MQGetMessageOptions_Response.MatchOptions = MQC.MQMO_MATCH_CORREL_ID
PublicMQVariable.MQGetMessageOptions_Response.WaitInterval = PublicMQVariable.MyTimeOut
PublicMQVariable.MyStopwatch = Stopwatch.StartNew()
PublicMQVariable.MQQueue_Reply.Get(PublicMQVariable.MQMessage_Reply, PublicMQVariable.MQGetMessageOptions_Reply)
PublicMQVariable.MyStopwatch.Stop()
PublicMQVariable.MyReplyMessage = PublicMQVariable.MQMessage_Reply.ReadString(PublicMQVariable.MQMessage_Reply.MessageLength)
Catch ex As MQException
MsgBox("MQException: compCode: " & ex.CompCode.ToString() & " Reason: " + ex.Reason.ToString() & " - " & ex.Message)
MQDisconnectAndClose()
Return
End Try
上面的代码只是响应为“get”的部分秒表表示在 +/- 2000 毫秒内收到回复,但是当我浏览回复队列时,回复消息仅在大约 18 秒后出现(查看我的不断观看和浏览队列)
- 这秒表的使用准确吗?
- 为什么消息在回复队列中可见需要这么长时间?
- 系统生成回复消息后是否可以立即捕获它?(甚至在它被放入回复队列之前)