What serialization method is used for an ActiveMQ NMS C# object message?

て烟熏妆下的殇ゞ 提交于 2019-12-06 13:23:00

The default is System.Runtime.Serialization.Formatters.Binary.BinaryFormatter for IObjectMessage.

You can set your own by e.g.

IObjectMessage m = session.CreateObjectMessage();

((ActiveMQObjectMessage)m).Formatter=new SoapFormatter();//Or any IFormatter

You'd need to set the formatter before accessing IObjectMessage.Body on the receiver side if you're not sending objects with the default BinaryFormatter.

If you wish, you can also send/receive IByteMessage/ITextMessage and serialize your objects to the messages yourself in any way you'd like.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!