views:

110

answers:

3

Are there any stateful eventing mechanisms in .net(c#) or any libraries that will help me maintain a state for the events fired

By stateful I mean an event when fired is serialized to a persistent storage. If the system fails for some reason and then when it is bought back picks up the serialized state and then fires it again.

I am also looking at scheduled events too - In this case the stateful event can be delegated to a future time and will be guaranteed to be fired at that time even if the system was bought down anytime in between.

Is there anything like this in .net?

A: 

You might be able to do something with PostSharp.

brian
how? Any links?
Quintin Par
Nothing specific, try googling PostSharp. If I remember correctly, the documentation is rather spartan but its pretty easy to work with. No guarantees it'll do what you need, but you might be able to massage it to fit your needs.
brian
+1  A: 

Although not technically a stateful event mechanism, Windows Workflow Foundation contains many features to handle these specific types of situations.

In particular, it has routines in place for serializing the work state to storage, handling failures, and recovery of long running processes with external events.

Reed Copsey
+1  A: 

There's a bit of a learning curve but Windows Workflow Foundation (WF) does exactly this. Workflows have activities which can involve raising or handling events and at various points in the workflow, the state of the whole workflow can be serialized. It supports SQL server out of the box but you can extend the persistence layer. When workflows are resumed from serialization they pick up where they left off.

It's worth noting that any serious investment in the current version of WF is discouraged because they completely rewrote it in .NET 4.0 and you should probably start with that if you don't have an investment in the current version.

Josh Einstein