Skip to content
Noel edited this page Apr 14, 2015 · 2 revisions

Spawn has been added to allow for the creation of an actor, with out the virtual Actor framework. its easy to use and inspired by the Erlang and AKKA.NET implementations. As with all things we need a NetMQContext object, to handle the message passing, a new context object has been created to handle this for us, this will get merged in with the silo shortly, and if you prefer you can use the Silo object in place of the context.

using (var context = ContextCreate())
{
    var actorReference = context.Spawn("Johnny", (message, sender, actor) =>
        {
            ////<Do stuff hear>
            ////You can access the actor, the message, and the sender object
        }
}

the spawn operation takes a lambda which will run every time a message is received, the lambda has access to the message -which is castable to the object you send, the sender object, so you can send a message in response, and the actor itself which provides access to channels to send messages to other actors, a property bag for persistence between messages.

Clone this wiki locally