This repository contains supplemental examples for my blog article, [Golang] Protoactor-go 101: How actors communicate with each other , to cover all message passing methods for all kinds of actors provided by protoactor-go.
For local message passing, see the below directories:
- local-send ... Use Send() for local message passing. The recipient actor cannot refer to the sender actor.
- local-request ... Use Request() for local message passing. The recipient actor can refer to the sender actor.
- local-future ... Use RequestFuture() for local message passing. Context.Sender() does not return the PID of sender actor but that of actor.Future.
- remote/messages ... Contain Protobuf serializable message structures. See README.md for code generation.
- rmeote/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/messages ... Contain Protobuf serializable message structures and generated actor.Actor implementation for gRPC based communication. See README.md for code generation.
Below examples use Consul Cluster Provider for service discovery. Run docker-compose -f docker-compose.yml up --build -d
or something equivalent to run Consul on your local environment.
- cluster-consul/cluster-pong ... A process that returns pong message to the sender based on remote actor implementation.
- cluster-consul/cluster-ping-send ... A process that sends message to pong actor by Send(). The recipient cannot refer to the sender actor.
- cluster-consul/cluster-ping-request ... A process that sends message to pong actor by Request(). The recipient actor can refer to the sender actor.
- cluster-consul/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.
Below examples use Consul Cluster Provider for service discovery. Run docker-compose -f docker-compose.yml up --build -d
or something equivalent to run Consul on your local environment.
- cluster-consul/cluster-pong-grpc ... A process that returns pong message to the sender via gRPC service.
- cluster-consul/cluster-ping-grpc ... A process that sends message to pong actor over gRPC based service.
Below examples use Automanaged Cluster Provider for service discovery
- cluster-automanaged/cluster-pong ... A process that returns pong message to the sender based on remote actor implementation.
- cluster-automanaged/cluster-ping-future ... A process that sends message to pong actor by Request(). The recipient actor can refer to the sender actor and therefore can successfully respond.
Below examples uses etcd Cluster Provider for service discovery. Run docker-compose -f docker-compose.yml up --build -d
or something equivalent to run etcd on your local environment.
- cluster-etcd/cluster-pong ... A process that returns pong message to the sender based on remote actor implementation.
- cluster-etcd/cluster-ping-future ... A process that sends message to pong actor by Request(). The recipient actor can refer to the sender actor and therefore can successfully respond.
- [Golang] Protoactor-go 101: Introduction to golang's actor model implementation
- [Golang] Protoactor-go 101: How actors communicate with each other
- [Golang] protoactor-go 101: How actor.Future works to synchronize concurrent task execution
- [Golang] protoactor-go 201: How middleware works to intercept incoming and outgoing messages
- [Golang] protoactor-go 201: Use plugins to add behaviors to an actor
- [Golang] protoactor-go 301: How proto.actor's clustering works to achieve higher availability
- oklahomer/protoactor-go-future-example
- Some example codes to illustrate how protoactor-go handles Future process
- oklahomer/protoactor-go-middleware-example
- Some example codes to illustrate how protoactor-go use Middleware