Background Tasks and Thread Pools in Microservices

(skipping earlier sections of the chapter)

Actix

The main types & traits of actix:

  • System Type: Maintains the actors system. Must be created before any other actors are spawned. System is itself an actor.
  • Actor Trait: Anything that implements Actor can be spawned.
  • Arbiter Type: An Arbiter is an event loop controller. Can only have one per thread.
  • Context Type: Every Actor works in a Context, which, to the runtime, represents an actor's environment. Can be used to spawn other tasks.
  • Address Type: Every spawned Actor has an Address, which can be used to send things to and from a targeted actor.
  • Message Trait: Types that implement Message can be sent thorugh a type that implements Address's send method. Message has an associated type, Result, which is the type of value that will be returned after the message is processed.
  • Handler Trait: Implemented on Actors and enables/facilitates the actor' message-handling functionality.