class Movie::ActorSystem(T)

Defined in:

movie.cr

Constructors

Instance Method Summary

Instance methods inherited from class Movie::AbstractActorSystem

actor_dispatch_enter : Nil actor_dispatch_enter, actor_dispatch_leave : Nil actor_dispatch_leave, actor_dispatching_on_current_fiber? : Bool actor_dispatching_on_current_fiber?, actor_for(path : ActorPath, type : T.class) : ActorRefBase forall T
actor_for(path_str : String, type : T.class) : ActorRefBase forall T
actor_for
, address : Address address, close_spawn_admission : Nil close_spawn_admission, cluster : Cluster::ClusterExtension | Nil cluster, cluster_enabled? : Bool cluster_enabled?, config : Config config, context(id : Int32) context, dead_letters : ActorRefBase dead_letters, deregister(id : Int32) deregister, dispatchers : DispatcherRegistry dispatchers, enable_cluster(settings : Cluster::ClusterSettings = Cluster::ClusterSettings.new) : Cluster::ClusterExtension enable_cluster, enable_remoting(host : String, port : Int32, stripe_count : Int32 = Remote::StripedConnectionPool::DEFAULT_STRIPE_COUNT, settings : Remote::AssociationSettings = Remote::AssociationSettings.new) : Remote::RemoteExtension enable_remoting, extension(type : T.class) : T | Nil forall T
extension(id : ExtensionId(T)) : T forall T
extension
, extension!(type : T.class) : T forall T extension!, extensions : ExtensionRegistry extensions, local_path?(path : ActorPath) : Bool local_path?, mailboxes : MailboxManager mailboxes, name : String name, next_id next_id, path_registry : PathRegistry path_registry, publish_remoting_address(address : Address) : Nil publish_remoting_address, register_context(id : Int32, context : AbstractActorContext) register_context, register_extension(extension : Extension) register_extension, remote : Remote::RemoteExtension | Nil remote, remoting_enabled? : Bool remoting_enabled?, scheduler : Scheduler scheduler, shutting_down? : Bool shutting_down?, spawn(behavior : AbstractBehavior(U), restart_strategy : RestartStrategy = RestartStrategy::RESTART, name : String | Nil = nil) : ActorRef(U) forall U
spawn(behavior : AbstractBehavior(U), restart_strategy : RestartStrategy, supervision_config : SupervisionConfig, name : String | Nil = nil) : ActorRef(U) forall U
spawn
, spawn_system_actor(behavior : AbstractBehavior(T), name : String, restart_strategy : RestartStrategy = RestartStrategy::RESTART, supervision_config : SupervisionConfig = SupervisionConfig.default) : ActorRef(T) forall T spawn_system_actor, system_actor(name : String, type : T.class) : ActorRefBase forall T system_actor, user_actor(name : String, type : T.class) : ActorRefBase forall T user_actor, with_spawn_admission(&) with_spawn_admission

Constructor Detail

def self.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.


[View source]
def self.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)


[View source]

Instance Method Detail

def <<(message) #

[View source]
def ask(message : T, response_type : R.class = Nil, timeout : Time::Span | Nil = nil) : Future(R) forall R #

[View source]
def 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.


[View source]
def config : Config #

Returns the configuration used to create this system.


[View source]
def shutdown(timeout : Time::Span = 5.seconds) : Nil #

[View source]
def shutting_down? : Bool #

[View source]
def 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}


[View source]
def 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


[View source]