views:

74

answers:

1

Imagine that we have stuff we want done in the system and sometimes exceptions are raised while doing it. We want to give the end users a report of those errors so they have an opportunity to fix the root of the problem and then re-invoke the thing that caused the error.

This obviously means we need to capture the "thing" in a way that allows it to be stored, reported on, and ultimately re-executed or discarded.

Does anyone have any suggestions for implementing this?

Thanks!

- Edit -

I read http://msdn.microsoft.com/en-us/magazine/cc163920.aspx

Now I'm thinking messaging might be the way to go. I'm wondering if maybe MassTransit or the like would be beneficial or overkill. I've been wanting to delve into EDA for a while and am thinking this might be an in.

+2  A: 

Use a Command pattern: http://en.wikipedia.org/wiki/Command%5Fpattern

CesarGon
This doesn't really address the "persistable" and "repeatable" parts.
Rob
I think I disagree. :-) The Command pattern is widely used to repeat commands. Wikipedia itself, in its first paragraph: "the command pattern is a design pattern in which an object is used to represent and encapsulate all the information needed **to call a method at a later time**". That addresses repeatable.Regarding persistable, Wikipedia may not mention anything, but modelling commands as first-class entities allows you to save them to any persistent medium.
CesarGon
+1 for command pattern, that thing will certainly solve your problem Rob
Rakesh Juyal
Rob
You're welcome. :-)
CesarGon
Rob, you can implement the command pattern easily using MT. Just create a message for the command, set the queue to transactional, and it will retry in the case of failure. After enough failures, commands are moved into the error queue, which you can requeue later once services are made available. You can also use the circuit breakers in Magnum to avoid hammering a known-down service. So if you have MSMQ available, MT will make using it much easier for sure.
Chris Patterson