WYSIWYG

http://kufli.blogspot.com
http://github.com/karthik20522

Saturday, August 9, 2014

AKKA.NET Actor Creation - Typed, Untyped, Receive Actor

There are three potential ways of creating Actors using Akka.net (v0.6.2).

1. Using Receive Actor: In order to use the Receive() method inside an actor the actor must inherit from ReceiveActor. All message handling must be part of the constructor. Please note that handler matches, the one that appears first is used. More info Akka.net documentation.

2. Using Typed Actor: In typed actor, you explicitly provide the message types that the actor would receive. This is very helpful in code readability as you are ware if type of message that the actor receives. For receive message, you need to define a overloaded "Handle" function with message types.

3. Using Untyped Actor: Untyped Actor, similar to Receive actor requires to pattern match the message type. For using Untyped actor, the OnReceive function needs to be overridden.
Handling unknown messages can be done 2 ways:

Labels: , ,