I am starting to look at Akka.Net framework with boot-camp.
I could understand the basic Actor concept and persistence using event sourcing.
I am stuck at understanding how a Domain Event will be dispatched and received by other actors.
Restricting to a single System locally deployed Actors and No DI containers and Using c# /ASP.NET API where I am separating each AgreegateRoot into its own project
I am conceptualizing something like
ManagerActor
- -AggregateRoot
- --ChildActor 1
- --ChildActor 2
- --ChildActor n
- -ValidationActor
- -AggregateRoot
Manager Actor will receive command message and go through validation process and if validated will be sent to AggregateRoot Actor. Event will be generated inside root or child actors.
please advise on following:
To publish an event on something similar to eventbus from inside an Entity can I use the below syntax?
Context.System.EventStream.Publish(MyEvent);
To Subscribe to an event I understood that the syntax is
System.EventStream.Subscribe( subscriber,MyEvent)
I want the event published by an Actor to be handled by Handlers (other Actors), of which current AggregateRoot Actor or Child Entity inside should have no knowledge.
This is where I am totally stuck. How is this achieved?
subscriber in System.EventStream.Subscribe, is IActorRef. To get this I would need knowledge of the class.
should I create a startup bootstrapper which will reference all projects/ AggregateRoots and build Subscriptions to message Types there?
I have tried to find blogs or write-ups but did not have much luck.
Thanks in Advance.