下面的示例代码演示了如何在BizTalk上将消息发送到MQ Series并如何设置MQMD_PutApplName属性以及其他上下文属性。
// get the MQSeries message from the incoming Biztalk message
MQMessage mqmsg = context.Read("ReceivedMQMsg", "urn:yourco:mqseries:properties");
// set the MQMD_PutApplName property
mqmsg.PutApplName = "myPutApplName";
// set other MQMD properties as needed
mqmsg.GroupId = new byte[] { 0x01, 0x02, 0x03, 0x04 };
mqmsg.UserIdentifier = new byte[] { 0x05, 0x06, 0x07, 0x08 };
// send the message to MQ Series
MQQueueManager qm = new MQQueueManager("myQM");
MQQueue queue = qm.AccessQueue("myQueue", MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);
queue.Put(mqmsg);
queue.Close();
qm.Disconnect();
在上面的代码中,我们使用context对象从BizTalk消息中提取MQSeries消息,并使用MQMessage类设置MQMD_PutApplName,并将其与其他MQMD属性一起设置。最后,我们使用MQQueue.Put()方法将消息发送到MQ Series。