Skip to content

oklahomer/protoactor-go-sender-example

Repository files navigation

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.

Local

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

  • 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 Grain

  • cluster/messages ... Contain Protobuf serializable message structures and generated actor.Actor implementation for gRPC based communication. See README.md for code generation.

Cluster Grain usage with remote communication

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 Grain usage with gRPC based communication

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 with Automanaged Cluster Provider

Below examples use Automanaged Cluster Provider for service discovery

Cluster with etcd Cluster Provider

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.

References

Other Example Codes