Error while receving messages from MSMQ queue

Error while receving messages from MSMQ queue

Post by SGVscCBOZW » Thu, 24 Feb 2005 22:39:04


Hi,

I using 'Microsoft BizTalk Server 2004\SDK\Samples\Adapters\SendMSMQMessage'
Sample to send message from .NET application to 'MSMQT' queue (receive
location), and code looks like this (which is 'Send Exact' method in samples
code);

MessageQueue mq = new
MessageQueue.Create("FormatName:DIRECT=OS:mac1\\Private$\\TestString_Queue");
Message msg = new Message();
msg.Label = "TestMessageLabel";
StreamWriter wr = new
StreamWriter(msg.BodyStream,System.Text.Encoding.Unicode);
wr.Write("Message to send");
wr.Flush();
mq.Send(msg,MessageQueueTransactionType.Single);

This is what Microsoft recommended to use. I am sending the same to message
to 'MSMQ' Queue using send MSMQT adapter. I could able to see the message in
my MSMQ queue (TestString_Queue). But the problem is, when I am reading the
message from 'MSMQ' queue using .NET application, it is generating an error,
which is:


"System.InvalidOperationException: Cannot find a formatter capable of
reading this message.
at System.Messaging.Message.get_Body()
at
Microsoft.Samples.BizTalk.SendMSMQMessage.Form1.btnReceiveExact_Click(Object
sender, EventArgs e) in c:\documents and
settings\v.prasad\desktop\sendmsmqmessage\form1.cs:line 384"

The following is the code, which I am using to receive MSMQ queue message:


MessageQueue mq = new
MessageQueue("FormatName:DIRECT=OS:mac1\\Private$\\TestString_Queue");
Message msg = new Message();
msg.Formatter = new XmlMessageFormatter(new string[] {"System.String,
mscorlib"});
msg = mq.Receive(new TimeSpan(0,0,5));
txtRec.Text = msg.Body.ToString();

In XmlMessageFormatter, what should be type I should use.

Please help

Prasad
 
 
 

Error while receving messages from MSMQ queue

Post by Matt Milne » Fri, 25 Feb 2005 12:09:44

Have you tried using a streamreader to read the bodystream property?

Matt

 
 
 

Error while receving messages from MSMQ queue

Post by SGVscCBOZW » Fri, 25 Feb 2005 19:15:02

Hi Matt,

Some how this problem is rectified. I got another problem with
NET-MSMQT-MSMQ. I am using filters option of Send port to bind with
ReceivePortName. When I am doing this orchestration are getting started.
So, how can I using this filters option (i.e., binding Send Port with
ReceivePortName) using expression shape or any other shape in orchestration,
so that it will call orchestration also.

Thanks

Prasad
 
 
 

Error while receving messages from MSMQ queue

Post by SGVscCBOZW » Fri, 25 Feb 2005 19:21:05

Hi Matt,

I got another problem (from 'How to call MSMQ message using MSMQT'). If I
am using filters option in Send port to bind with ReceivePortName. When I am
doing this; orchestration is NOT getting called (i think it is right
behaviour). So, how can I use this filters option (i.e., binding Send Port
with ReceivePortName) using expression shape or any other shape in
orchestration, so that it will call orchestration also.

Thanks

Prasad
 
 
 

Error while receving messages from MSMQ queue

Post by SGVscCBOZW » Fri, 25 Feb 2005 19:29:05

Hi Matt,

Sorry it is typing mistake, in 3rd message and in 3rd line of this subject,
it is said as "When I am doing this orchestration are getting started". I
want to write "When I am doing this orchestration is NOT getting started".
Please observe this.

Thanks

Prasad
 
 
 

Error while receving messages from MSMQ queue

Post by Matt Milne » Thu, 03 Mar 2005 15:27:17

f the orchestration is bound to the receive port and has the right message
type (and is enlisted and started) then it should get started even if you
have a send port with a filter that is getting that message as well. That's
the publish and subscribe part of BizTalk. The message comes in and is
published and ALL subscribers receive the message. So, you should focus on
getting your orchestration bound to the receive port and make sure the
message type is correct. You may need to make sure you have the right type
of pipeline configured for the receive.

However, if what you are trying to do is put a filter on an orchestration,
you can do this in an activate receive shape. There is a property for the
filter and it works just like the window in the send port except that it
will only show you message context properties and the message data
properties that are present in the message type you are receiving.

HTH,
Matt


"Help Needed" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...