Skip to main content

How actors communicate with each other

note

This repository provides supplemental examples for the blog article [Golang] Protoactor-go 101: How actors communicate with each other, covering all message-passing methods for the various actors provided by protoactor-go. For higher-level guidance see Message Patterns and the Ask Pattern.

Components

Local​

For local message passing, see below directory:

Local Send​

Use Send() for local message passing. The recipient actor cannot refer to the sender actor. Source Code

Local Request​

Use Request() for local message passing. The recipient actor can refer to the sender actor. Source Code

Local Future​

Use RequestFuture() for local message passing. Context.Sender() does not return the PID of sender actor but that of actor.Future. Source Code

Remote​

  • remote/messages ... Contain Protobuf serializable message structures.
  • remote/remote-pong ... A process that returns pong message to sender.
  • remote/remote-ping-send ... A process that sends message to pong actor by Send(). The recipient cannot refer to the sender actor.
  • remote/remote-ping-request ... A process that sends message to pong actor by Request(). The recipient actor can refer to the sender actor.
  • remote/remote-ping-future ... A process that sends message to pong actor by RequestFuture(). Context.Sender() does not return the PID of sender actor but that of actor.Future.

Cluster Grain​

  • cluster/messages ... Contain Protobuf serializable message structures and generated actor.Actor implementation for gRPC based communication.

Cluster Grain usage with remote communication​

  • cluster/cluster-pong-remote ... A process that returns pong message to the sender based on remote actor implementation.
  • cluster/cluster-ping-send ... A process that sends message to pong actor by Send(). The recipient cannot refer to the sender actor.
  • cluster/cluster-ping-request ... A process that sends message to pong actor by Request(). The recipient actor can refer to the sender actor.
  • cluster/cluster-ping-future ... A process that sends message to pong actor by RequestFuture(). Context.Sender() does not return the PID of sender actor but that of actor.Future.

Cluster Grain usage with gRPC based communication​

  • cluster/cluster-pong-grpc ... A process that returns pong message to the sender via gRPC service.
  • cluster/cluster-ping-grpc ... A process that sends message to pong actor over gRPC based service.

References​