English 中文(简体)
MSMQ Adding a delay on Messages
原标题:
  • 时间:2009-12-01 11:44:31
  •  标签:
  • msmq

I have a Microsoft Message Queue that gets populated with messages. If there is a problem with the processing of the message, I would like to retry the message, I do not want to retry the message immidiatley. Is there a way to add a delay to the message in the MSMQ to avoid it being available for a certain amount of time??

The other alternative is to have another queue (A retry queue) and read that queue every 15 minutes, But i would rather not do this.

最佳回答

What you are looking for is "Poison Message Handling" ( even if its not the message fault, but an temporary environment problem ).

There are lots of articles on that. Here are some:

Poison Message Handling in MSMQ 3.0
Poison Message Handling in MSMQ 4.0
Surviving poison messages in MSMQ

In short: you have to move them to a retry queue.

问题回答

So I ve seen some code recently that handles this in the exception logic, the code has a built in retry step that attempts after a delay. It fails, waits for a specific amount of time, then tries again.

Essentially it recursively tries a set number of times (lengthening the delay each time). Fairly neat, no reason to have another queue. There is alot of generics and delegates used to execute the methods. Don t know if something like this could be done or not. I would suspect you would still want to handle the case of the message not being able to be delivered with another queue though.





相关问题
Private or Public MSMQ

We are using Queue for few of are WCF services. We are using NetMSMQ binding for the WCF services which use Private MSMQ. The system works OK on our QA environment. I am not sure of any real ...

how to archive msmq messages?

I have a bunch of messages in one of the queues from an old date. I would like to take a backup before purging them. Any thoughts? Schar

MSMQ Adding a delay on Messages

I have a Microsoft Message Queue that gets populated with messages. If there is a problem with the processing of the message, I would like to retry the message, I do not want to retry the message ...

clear Message Queue in C#

I use the Message Queue to send messages from one application to the other one (this has to work only on one particular machine) I create the queue like this on the receiver side: string ...

Getting the NServiceBus Distributor Sample To Work

I m trying to use the Distributor in the NServiceBus FullDuplex sample but I can t get it working. I ve been following the this guide Getting the NServiceBus Distributor Working, but it doesn t work. ...

热门标签