18 Months of Event Sourcing and CQRS Using Microsoft Orleans
AndyHoyle1
1,670 views
16 slides
Mar 07, 2019
Slide 1 of 16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
About This Presentation
A brief overview of the technologies involved and how we've used them at Fifty3North to deliver a real-time event based products using EventStore, Orleans and Redis
Size: 2.57 MB
Language: en
Added: Mar 07, 2019
Slides: 16 pages
Slide Content
▪Solution developed for Capture Education
▪Software for nurseries to collect evidence of
learning
▪Existing web based version built by another
supplier
▪Offline support
▪iOS and Android
▪Phone and tablet
▪Companion parent app
▪Scales to minimum 100k concurrent users
•
•
Command and Query
Responsibility Segregation.
Separating the reads from
the writes makes sense
because most applications
are either read heavy or
write heavy. By separating
these you can scale them
independently.
Consists of many actors made
up of their own behaviour and
optionally own private state.
Communication with actors
and between actors is message
based. By default, an actor can
process a single message at a
time and any further messages
passed to an actor will be
placed in a mailbox for future
processing. Traditionally uses
many nodes in a cluster to host
actors to scale computation.
Storing events which
triggered state changes
within the system as a
stream of facts. These facts
can be used to rehydrate
state at any time.
Greg Young’s Event Store
https://geteventstore.org is
one implementation (we
use this)
▪Virtual Actors -distributed computing with a low barrier to entry.
▪All calls must be async using standard async await and use the standard Orleans Task Scheduler.
▪Avoid .Wait() and .Result at all costs.
▪All method parameters must be serializable.
▪No need to worry about whether the actor (grain) is located
on a local or remote node (silo).
▪Update multiple data stores concurrently
▪Writes are instant, read models are eventually consistent.
▪Tell (Perform an action, change state etc.)
▪Ask (Give me information)
▪See http://bit.do/orleankka
▪A command handler in the actor decides if the
Command can be processed.
▪If this validation is successful, an Event is raised.
▪This event is the source of truthfor the entire
system.
▪It is an undisputed action that happened at a point
in time. This is the most important piece of
information. All other information can be derived
from these events.
▪Because of this, the first thing we do is write it to
the event store.
▪We then use the event to mutate the actor’s state.
This is an in-memory update to state so is very fast.
▪Read the list of events from EventStorefor this actor
▪Call event handler on the actor for each event in the stream
▪Very fast –in memory updates only
▪Snapshots enabled every 100 events
▪Forwards on events to other actors
▪Used to create transaction as a result of a command
▪Implicit subscriptions to actors’ Orleans streams
▪Re-entrant & Worker attributes