views:

15

answers:

1

I'm new to MSMQ and trying to understand when to use MessageQueueTransaction class. For example, is there any value to create a simple transaction just for putting a message in the MSMQ queue like this?

  using (MessageQueueTransaction t = new MessageQueueTransaction())
  {
     t.Begin();
     Message m = new Message(myString, formatter);
     queue.Send(m, t);
     t.Commit();
  }

I can't think of any and am tempted to reduce this code to....

     Message m = new Message(myString, formatter);
     queue.Send(m, t);

Am I losing anything? Any chance this is going to end up in a partially sent corrupted state?

-MSMQnfused

+1  A: 

That is fine, since you only have a single step

Poker Villain