Sponsor: Using RabbitMQ or Azure Service Bus in your .NET systems? Well, you could just use their SDKs and roll your own serialization, routing, outbox, retries, and telemetry. I mean, seriously, how hard could it be?

Blog Post Series:
- Part 1 – Practical Orleans
- Part 2 – Grains and Silos
- Part 3 – Smart Cache Pattern
- Part 4 – Event Sourced Grain
- Part 5 – EventStore for Grain Persistence
Event Sourced Grain
I’m going to create a typical example using a bank account. There are basically two events we will raise.Deposited
event to indicated that we have deposited money into the account and and Withdrawn
event to that we have taken money out of the account.
Orleans provides a package Microsoft.Orleans.EventSourcing to help raise events from you Grain as well as apply them to the state. From the package, you now can have your grain derive from JournaledGrain<TState, TEvent>.
Grain State
From the example Grain above we are missing our actual grain state, which really a projection so we can keep our current balance. Once an event is Raised the Grain will call the appropriateApply(T evnt)
method in our state.
Persistence
