我正在尝试使用 .Net 客户端使用本地 api [amqmdnet - WebSphere MQ Classes for .NET] 从远程 MQ 接收逻辑分组的消息,这是由 java 客户端使用本地 api 放置的。
当我们得到逻辑分组的消息时,我们会在该组中的所有消息中看到一些标题信息,这些信息将在每个编辑器中以不同的方式显示,[notepad++,editplus 等]
下面指定的标头信息附加在该组中的每个逻辑消息中,例如“MDE”
我们正在使用getmessageoptions
,openoptions
如下所示,
mintMQQueueOpenOptions = IBM.WMQ.MQC.MQOO_INPUT_SHARED + IBM.WMQ.MQC.MQOO_FAIL_IF_QUIESCING
mobjMQGetMessageOptions = New MQGetMessageOptions
mobjMQGetMessageOptions.Options = IBM.WMQ.MQC.MQGMO_NO_SYNCPOINT + IBM.WMQ.MQC.MQGMO_FAIL_IF_QUIESCING
'mobjMQGetMessageOptions.Options = mobjMQGetMessageOptions.Options + MQC.MQGMO_LOGICAL_ORDER 'Or MQC.MQGMO_ALL_MSGS_AVAILABLE
读取该组中所有逻辑消息的代码片段,
'=================================
' INTANTIATE THE MQ MESSAGE OBJECT
objMQMessage = New MQMessage
objMQMessage.Format = MQC.MQFMT_STRING
'=================================
' CLEAR THE MESSAGE VARIABLE
strMQMessage = ""
Do
'============================
' GET THE MESSAGE FROM THE MQ
mobjMQQueue.Get(objMQMessage, mobjMQGetMessageOptions)
'============================
' READ THROUGH THE MESSAGE
strMQMessage += objMQMessage.ReadString(objMQMessage.MessageLength)
'============================
' SET GMO.MATCHOPTIONS TO GROUP ID, INITIALLY IT WAS SET TO "MQC.MQMO_NONE"
mobjMQGetMessageOptions.MatchOptions = MQC.MQMO_MATCH_GROUP_ID
'============================
' DO UNTIL - MESSAGE IS THE LAST IN THE GROUP OR THE GROUP CONSISTS OF ONLY ONE MESSAGE.
Loop While (mobjMQGetMessageOptions.GroupStatus <> MQC.MQGS_LAST_MSG_IN_GROUP)
'====================================
' COLLECT THE MESSAGE IN AN ARRAYLIST
If Not String.IsNullOrEmpty(strMQMessage) Then objMQMessageList.Add(strMQMessage)
'============================
' COMMIT THE FETCH OPERATION
mobjMQQueueManager.Commit()
我们如何从每条消息中删除此标头信息?