Memstate is a complete redesign of OrigoDB with major improvements in key areas such as performance, availability, licensing, cross-platform, docker and cloud support.
Performance - OrigoDB can process up to 3K write transactions per second, Memstate can process up to 100K, a 33x improvement!
High Availability - An OrigoDB cluster has a single primary and one or more read-only replicas. If the primary fails one of the replicas can be promoted to new primary but this requires manual intervention. Nodes in a Memstate cluster are all read/write.
Licensing - OrigoDB Server is a commercial offering while Memstate server is OSS and free for commercial use.
Cross platform - Memstate targets .NET Standard 2.0 which means it runs on both .NET Framework >= 4.6.1 and .NET Core >=2.0, Mono, Xamarin, UWP.
OrigoDB domain events are an effort to support event driven, reactive designs. Capture domain events to trigger additional external behavior like sending emails, updating read models, sending messages, relaying through web sockets, etc. Zero or more events are produced during command execution. Events are not yet supported for remote connections or when using proxy.
Events are published via the Model.Events property, captured by the Engine during command execution and exposed through the Engine.CommandExecuted event.
Modeling domain events
Events should be immutable - you can’t change historical facts
Event names should be verbs in the past tense
Events must not expose mutable references to objects within the model
Events must implement the empty IEvent marker interface
Consider marking events Serializable
An example event
Publishing and subscribing to events
The Model.Events property is an object of type FilteringEventDispatcher with the following methods:
Subscribe and Send examples
Subscribe to events directly on the model or by handling Engine.CommandExecuted events:
Patterns for producing events
Any code with a reference to the model can publish events by calling Model.Events.Send(). The two obvious places are from within the model or within Command.Execute. Here are examples of both:
Unsubscribing
The FilteringEventDispatcher uses the subscribed handler and delegate objects as keys. To unsubscribe you must pass the same object used to subscribe. Subscriptions registered using the On cannot be unsubscribed.