Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is MSMQ thread safe?

I have multiple processes monitoring an MSMQ queue. I want to do multi-step operations like first peek the message and then based on some criteria receive the message. A single message may pass the receiving criteria of multiple processes so that more than one process may try to receive the same message. Will these operations be thread safe? If not what should I do to prevent one process from failing to receive the message that other process has already received?

like image 405
Raminder Avatar asked Oct 22 '08 06:10

Raminder


People also ask

Are message queues thread safe?

Queues are thread safe in that multiple tasks can try to concurrently write to or read from a given queue, and the queue will handle the syncronization so that each message gets put in as a unique message and each message gets sent to a single task.

Is MSMQ asynchronous?

Microsoft Message Queue server, short MSMQ, provides exactly that - guaranteed and reliable message delivery. It provides an easy way to send messages between different applications or to process messages asynchronously.

Why do we use MSMQ?

Message Queuing (MSMQ) technology enables applications running at different times to communicate across heterogeneous networks and systems that may be temporarily offline. Applications send messages to queues and read messages from queues.

What is MSMQ C#?

Microsoft Messaging Queue (MSMQ) technology is used for asynchronous communication using messages. MSMQ also can be considered to be an Inter- process communication capability. Whenever two processes want to communicate with each other in a "Fire and Forget" manner, MSMQ is very useful for that. Usage.


1 Answers

According to MSDN:

Only the following methods are thread safe: BeginPeek, BeginReceive, EndPeek(IAsyncResult), EndReceive(IAsyncResult), GetAllMessages, Peek, and Receive.

like image 157
EggyBach Avatar answered Nov 11 '22 03:11

EggyBach