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

I am planning to use Apache NMS for ActiveMQ messaging and I am wondering which serialization method will be used for the objects that I send? XML / Binary? What controls serialization and how do I set it up?

Does anyone have any experience with C # objects? Are there pitfalls that you know about?


source to share

1 answer

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

You can install your own for example.

IObjectMessage m = session.CreateObjectMessage();

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


You will need to set formatting before accessing IObjectMessage.Body on the receiver side, unless you are sending objects with the standard BinaryFormatter.

If you want, you can also send / receive IByteMessage / ITextMessage and serialize your objects to messages yourself in any way you would like.



All Articles