This repository shows usages of
Future.Wait() or Future.Result() wait until the response comes or the execution times out. Since the actor blocks, incoming messages stuck in the mailbox.
Example code is located at ./wait.
When the response comes back before Future times out, the response message is sent to the PipeTo destination. This does not block the actor so the incoming messages are executed as they come in. If the later message's execution is finished before the previous one, the response for the later message is received first as depicted in the below diagram. When the execution times out, the response is sent to dead letter mailbox and the caller actor never gets noticed.
Example code is located at ./pipe.
The message execution is done in the same way as Future.PipeTo, but a callback function is called even when the execution times out.
Example code is located at ./await_future.
- [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