Go C#


Proto.Actor provides two forms of Context, a RootContext and an ActorContext. These contexts are composed of various functionality provided by distinct facets. Both types of context implement Spawner, Stopper, Info and Sender facets, while the ActorContext implements additional facets.

Root Context Facets

Actor Context Facets

Context Facets


Implemented by RootContext, ActorContext

Provides the ability to spawn new actors given a Props parameter.

    var system = new ActorSystem();
    var props = Props.FromProducer(() => new GreetingActor());
    var pid = system.Root.Spawn(props);

    // other actor spawning methods:
    // system.Root.SpawnNamed(props, name: "greeter");
    // system.Root.SpawnPrefix(props, prefix: "greet-");


Implemented by RootContext, ActorContext

Provides the ability to immediatly stop an actor, or instruct it to stop after processing current mailbox messages.

    // stop immediately
    await context.StopAsync(pid);

    // stop after processing current user messages in mailbox
    await context.PoisonAsync(pid);


Implemented by RootContext, ActorContext

Provides access to information about the context such as the current actor’s Parent PID, its Self PID, the Sender PID of the current message, the Actor itself, and the ActorSystem in which the actor resides.


Implemented by RootContext, ActorContext

Provides the ability to Send fire-and-forget style messages and Request responses from an actor asynchronously.

    var message = new MyMessage();
    var request = new MyRequest();

    context.Send(pid, message);
    var response = context.Request<MyResponse>(pid, request);


Implemented by ActorContext

Provides the ability to Receive messages wrapped in a MessageEnvelope

    await context.Receive(envelope);


Implemented by ActorContext

Invocation provides abilities to invoke system messages, invoke user messages, and escalate failures.


Implemented by ActorContext

Supervision provides methods for controlling the lifecycle of child actors under supervision of the current actor and the ability to escalate failures up to the next actor in a supervision hierarchy.