简体   繁体   English

读写标题消息MQ C#

[英]Read And Write To Header Message MQ C#

I am reading an MQMessage in like so 我正在这样阅读MQMessage

       queue.Get(message, gmo);

        string message1 = message.ReadString(message.MessageLength);

I can see there is a message.UserId on MQMessage , but that is not enough 我可以看到message.UserId on MQMessage有一个message.UserId on MQMessage ,但这还不够

I want the users to get additional information in the message header of an MQMessage. 我希望用户在MQMessage的消息头中获得更多信息。

How can I set and then retrieve the following from a header of an MQMessage 如何设置然后从MQMessage的标题中检索以下内容

username 
password
mySpecialID

可以这样做

msg.SetStringProperty("NicksProp", "blahblah");

Note: MQ treats message properties as plain text, so if you are sending a password as a message property then EVERYONE can see it. 注意:MQ将消息属性视为纯文本,因此,如果您将密码作为消息属性发送,则每个人都可以看到它。 You will be able to see it via WireShark, and/or in the queue with any tool (MQ Explorer) and/or in the MQ log files. 您将能够通过WireShark和/或使用任何工具(MQ Explorer)在队列中和/或在MQ日志文件中看到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM