Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF and MSMQ failure handling

Tags:

c#

.net

wcf

queue

msmq

Can someone explain to me the difference between these 3 approaches to processing messages that fail delivery?

  • Poison Queue service
  • Dead-Letter Queue service
  • Using a response service to handle failures

I have "Programming WCF", but I don't really understand when you would use one of these over another, or when it would make sense to use more than one of them. Thanks!

like image 971
chessguy Avatar asked Nov 13 '08 21:11

chessguy


People also ask

How does MSMQ work with WCF?

MSMQ is Microsoft Message Queuing developed by Microsoft and deployed in windows operating system. MSMQ Queue ensures that reliable messaging between a client and a Windows Communication Foundation (WCF) service. So first we need to enable this feature in our operating system.

What is the replacement for MSMQ?

Kafka, RabbitMQ, IBM MQ, Azure Service Bus, and ActiveMQ are the most popular alternatives and competitors to MSMQ.

Is MSMQ dead?

Microsoft Message Queuing, better known by its nickname MSMQ, passed away peacefully in its hometown of Redmond, Washington on October 14, 2019, at the age of 22. It was born in May 1997 and through 6.3 versions lived a very full life, bringing the promise of reliable messaging patterns to users all around the globe.


2 Answers

Dead and poison are two different concepts. Poison messages are messages that can be read from the queue, but your code doesn't know how to handle it so your code gives an exception. If this goes on for some time you want this message to be put on a different queue so your other messages can be handled. A good aproach for this is described on MSDN.

A dead letter is a message that isn't even handled by the queue. The network is broken or the receiving MSMQ computer is shut down. Something like that. The message will automaticly be put on the dead queue after some time by Windows. So it's advisable to write a service that monitors the dead queue.

like image 194
Olivier Avatar answered Nov 10 '22 04:11

Olivier


Poison message / dead letter message queues are used to place messages that have been determined to be undeliverable in a queue that will not try to deliver them anymore. You would do this if you might want to manually take a look at failed messages and process them at a later point. You use these type of queues when you want to keep bad messages from degrading the performance of your system by retrying over and over again.

On the other hand, a response service would be used to notify the sender that there was an error processing the message. Typically in this case you aren't planning on manually processing the bad message and need to let the system that sent the message in that the request has been rejected.

Note that these aren't exclusive. If you are using queues, there is always the chance that the message serialization might change enough to break messages that are in the queue in which case you might still want to have a dead letter queue even if you are using a response service.

like image 43
jezell Avatar answered Nov 10 '22 05:11

jezell