Reading text-only body from MSMQ in C#

L

Lee Zeitz

Hello,

I have a need to read messages from MSMQ (on the order of 350,000 messages
per day) that have a body that is text-only (not in XML format). There are
3 message formats to select from (XMLMessageFormatter,
ActiveXMessageFormatter, and BinaryMessageFormatter). All samples that I
have found indicate use XMLMessageFormatter, but I am not sure I should use
this because my message is text.

Does anyone know how I should read these messages?
 
D

David Browne

Lee Zeitz said:
Hello,

I have a need to read messages from MSMQ (on the order of 350,000 messages
per day) that have a body that is text-only (not in XML format). There
are 3 message formats to select from (XMLMessageFormatter,
ActiveXMessageFormatter, and BinaryMessageFormatter). All samples that I
have found indicate use XMLMessageFormatter, but I am not sure I should
use this because my message is text.

Does anyone know how I should read these messages?
You should read them using whichever message formatter was used to send the
messages. Any of them will work.

David
 
L

Lee

Thats the problem. Our company has legacy software written over the
years that submits (from VB 6, VBScript, etc) to the queue. This
software exists company-wide, so it is not possible to re-write all of
it.

I am re-writing our application that reads the information from specific
MSMQs because the old VB6 app that performed this task had memory leaks,
and could not perform threading - which I need to keep up with the
volume of records being read.

My messages will not have an XML header in the body, so I am trying to
figure how Microsoft enables this situation to be handled.
 
G

Guest

Normally anything sent via VBScript or VB would be using the
ActiveXMessageFormatter. This is one of your Formatter choices as described
by previous posters.
 
L

Lee Zeitz

Are there any good examples of this? I have been looking, but only find
examples for the XMLMessageFormatter.

Lee Zeitz
 
G

Guest

MessageQueue mqReceive = new MessageQueue(QueuePath);
mqReceive.Formatter = new ActiveXMessageFormatter();
// here call whatever method on mqReceive object (read, peek, BeginReceive,
etc.)


Suggestion: Spend a few hours reading over the MSDN documentation - it will
help you to avoid having to constantly post to newsgroups for the basics and
wait for answers!
Peter


Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 

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