Are messages with order in transactional queues possible in MSMQ?

I'm new to messaging and a bit unclear as to whether it is possible for MSMQ to deliver unordered messages for transactional queues. I believe that this should be because if the message is not processed correctly (and since we will use several "competing consumers"), then other consumers can continue to process the messages until the error message is put back in the queue. I just can’t find a black and white answer somewhere on this.

+4
source share
2 answers
  • A negative black and white answer is hard to find (they don't often exist).
  • Here you mix the two terms (I think). delivery from the sender to the queue. consumption - from the line to the consumer. These two actions cannot be placed in one transaction. This is a completely separate action (this is one of the points in the queue).

Read More: From Microsoft Message Queuing Services (MSMQ) Tips

For these messages to be sent together, in the order in which they were sent, or not at all. In addition, consecutive transactions initiated from the same computer in one queue will arrive in the order in which they were made relative to each other.

This is the only case of order in msmq.

Unfortunately, you will not find anything about the ordered needs, because it does not matter. You can consume messages from msmq in any way.

Update: If you need to order processing, I see no reason to use many consumers. You will need to complete the order in your code.

+4
source

Do you need to process your messages because:

1) Are these different workflow steps? If so, you should create different queues to handle the various steps. Process 1 reads Queue 1, does its job, then writes to Queue 2, etc.

2) Do they have different priorities? If the priority levels are rather rough (and the order of the messages in the priorities does not matter), you should create priority and low priority queues. At first, consumers read from higher priority queues.

3) This rule defines the business rule. For example, "sales orders must be processed in the order in which they are received." Message queues are not suitable for this kind of sequence because they only convey the order in which messages are received. A process that periodically checks the database for an ordered list of tasks would be more appropriate.

0
source

All Articles