Reading text-only body from MSMQ in C#

  • Thread starter Thread starter Lee Zeitz
  • Start date Start date
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?
 
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
 
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.
 
Normally anything sent via VBScript or VB would be using the
ActiveXMessageFormatter. This is one of your Formatter choices as described
by previous posters.
 
Are there any good examples of this? I have been looking, but only find
examples for the XMLMessageFormatter.

Lee Zeitz
 
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
 
Back
Top