class

Movie::ActorSystem(T)

Inherits Movie::AbstractActorSystem < Reference < Object

Constructors

new(main_behavior : AbstractBehavior(T), restart_strategy : RestartStrategy = RestartStrategy::RESTART, supervision_config : SupervisionConfig = SupervisionConfig.default, name : String = "actor-system-#{UUID.random.to_s[0..7]}") forall T

Creates an ActorSystem with explicit parameters.

Source
new(main_behavior : AbstractBehavior(T), config : Config) forall T

Creates an ActorSystem from a Config. Config values override defaults. See ActorSystemConfig for available paths.

Example: config = Movie::Config.load("movie.yml", Movie::ActorSystemConfig.default) system = Movie::ActorSystem.new(main_behavior, config)

Source

Instance methods

<<(message)
Source
ask(message : T, response_type : R.class = Nil, timeout : Time::Span | Nil = nil) : Future(R) forall R
Source
ask(target : ActorRef(M), message : M, response_type : R.class = Nil, timeout : Time::Span | Nil = nil) : Future(R) forall M, R

Ask a specific actor and receive a response, similar to ActorContext#ask.

Source
config

Returns the configuration used to create this system.

Source
spawn(behavior : AbstractBehavior(U), restart_strategy : RestartStrategy = RestartStrategy::RESTART, supervision_config : SupervisionConfig = @supervision_config, name : String | Nil = nil) : ActorRef(U) forall U

Spawns an actor under the user guardian. If name is provided, the actor gets path /user/{name}

Source
spawn_child(behavior : AbstractBehavior(U), restart_strategy : RestartStrategy, supervision_config : SupervisionConfig, name : String | Nil, parent_path : ActorPath | Nil) : ActorRef(U) forall U

Internal: spawns a child actor under a parent's path

Source