Microsoft Message Queue

S

Steve Lutz

Hi All,

I am trying to read and write to a message queue. (System.Messaging) I can
read and write to a queue. However, the consummers of the queue messages are
going to be a mixed bag of application, some of which I do not have control
over. When I send a message to the queue, the body of the message is
formatted into XML. I do not want this to happen. I just want to put my data
directly into the body as is, without .NET putting XML wrappers around it.

Anyone know how to accomplish this?

Steve
 
D

DalePres

You can use the BinaryMessageFormatter or ActiveXMessageFormatter to
serialize messages without using XML. By default, the XML formatter is
created and associated when the queue object is created in your application.
Just create one of the other formatters and assign it to the formatter
property.


Dale
 
J

Jay B. Harlow [MVP - Outlook]

Steve,
How is your data represented now? What do you mean by "as is"?

As Dale stated: If you are using the Message.Body property your choices are
BinaryMessageFormatter, ActiveXMessageFormatter, or XmlMessageFormatter. Or
you could write your own Formatter (by implementing IMessageFormatter) to
get the specific format you want...

Alternatively you could set the Message.BodyStream to a System.IO.Stream
(for example a MemoryStream) instead of setting the Message.Body property.

For details on how the Message.Formatter, Message.Body & Message.BodyStream
interact see the Message.BodyStream topic in the online help.

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top