tags:

views:

921

answers:

2

My code :

  string _path = "mymachine\\Private$\\example";
  // create a message queue object
  MessageQueue MQueue = new MessageQueue(_path);

  // create the message and set the base properties
  Message Msg = new Message("Messagem");
  Msg.ResponseQueue = MQueue;
  Msg.Priority = MessagePriority.Normal;
  Msg.UseJournalQueue = true;
  Msg.Label = "gps1";      

  // send the message
  MQueue.Send(Msg);

  // close the mesage queue
  MQueue.Close();

No error, but nothing in my MessageQueue... Any help?

+1  A: 

I found the problem... My MessageQueue was created with transaction true...

Paul
That is an annoying issue with MSMQ (or the .NET wrapper, I'm not sure where the issue comes in).
Harper Shelby
Correct. You need to replace the last two methods with.. MQueue.Send(Msg, transaction); transaction.Commit(); MQueue.Close(); .. Otherwise, when you create the new Queue, turn transactions off -> New MessageQueue(_path, false);
Pure.Krome
A: 

new bee to MSMQ, this helped me a lot..

though after breaking my head for 1/2 hour

Sharique Khan