abstract class Movie::AbstractActorSystem

Direct Known Subclasses

Defined in:

movie.cr

Instance Method Summary

Instance Method Detail

def actor_dispatch_enter : Nil #

[View source]
def actor_dispatch_leave : Nil #

[View source]
def actor_dispatching_on_current_fiber? : Bool #

[View source]
def actor_for(path : ActorPath, type : T.class) : ActorRefBase forall T #

Unified actor lookup - returns local or remote actor ref based on path. For local paths (matching this system's address), returns the local ActorRef. For remote paths, returns a RemoteActorRef that transparently handles serialization.

Example: ref = system.actor_for("movie.tcp://my-system@localhost:9000/user/worker", MyMessage) ref << MyMessage.new # Works for both local and remote


[View source]
def actor_for(path_str : String, type : T.class) : ActorRefBase forall T #

Convenience overload that parses a path string. Supports multiple formats:

  • Full URI: "movie://system/user/ping" or "movie.tcp://system@host:port/user/ping"
  • Absolute path: "/user/ping" → auto-prepends local system address
  • Relative path: "user/ping" → auto-prepends local system address

[View source]
def address : Address #

The address of this actor system (local by default, remote when remoting is enabled)


[View source]
def close_spawn_admission : Nil #

[View source]
def cluster : Cluster::ClusterExtension | Nil #

[View source]
def cluster_enabled? : Bool #

[View source]
def config : Config #

Returns a config instance (empty for systems without config).


[View source]
def context(id : Int32) #

[View source]
def dead_letters : ActorRefBase #

[View source]
def deregister(id : Int32) #

[View source]
def dispatchers : DispatcherRegistry #

[View source]
def enable_cluster(settings : Cluster::ClusterSettings = Cluster::ClusterSettings.new) : Cluster::ClusterExtension #

Enables static-seed cluster membership above an existing remoting extension. Repeated calls return the same extension instance.


[View source]
def enable_remoting(host : String, port : Int32, stripe_count : Int32 = Remote::StripedConnectionPool::DEFAULT_STRIPE_COUNT, settings : Remote::AssociationSettings = Remote::AssociationSettings.new) : Remote::RemoteExtension #

Enables remoting on this actor system. Returns the RemoteExtension for configuring remote communication.


[View source]
def extension(type : T.class) : T | Nil forall T #

Returns an extension by type, or nil if not registered. Example: system.extension(Remote::RemoteExtension)


[View source]
def extension(id : ExtensionId(T)) : T forall T #

Returns an extension via an ExtensionId (Akka-style lazy access). Example: Movie::Remote::Remoting.get(system)


[View source]
def extension!(type : T.class) : T forall T #

Returns an extension by type, raising if not found.


[View source]
def extensions : ExtensionRegistry #

Registry for system extensions


[View source]
def local_path?(path : ActorPath) : Bool #

Checks if a path refers to this local system.


[View source]
def mailboxes : MailboxManager #

[View source]
def name : String #

The unique name of this actor system


[View source]
def next_id #

[View source]
def path_registry : PathRegistry #

Registry for actor paths (both local and remote lookups)


[View source]
def publish_remoting_address(address : Address) : Nil #

Publishes the actual address selected by a remoting extension and rebinds every existing local actor path to it.


[View source]
def register_context(id : Int32, context : AbstractActorContext) #

Registers an actor context in the system registry


[View source]
def register_extension(extension : Extension) #

Registers an extension with this actor system. The extension will be started immediately and stopped when the system shuts down.


[View source]
def remote : Remote::RemoteExtension | Nil #

Returns the remote extension if remoting is enabled. Convenience method - equivalent to extension(Remote::RemoteExtension)


[View source]
def remoting_enabled? : Bool #

Returns true if remoting is enabled.


[View source]
def scheduler : Scheduler #

Returns the system scheduler for scheduling timers and delayed tasks. Uses a dedicated scheduler dispatcher for execution.


[View source]
def shutting_down? : Bool #

[View source]
def spawn(behavior : AbstractBehavior(U), restart_strategy : RestartStrategy = RestartStrategy::RESTART, name : String | Nil = nil) : ActorRef(U) forall U #

Spawns an actor under the user guardian using registry defaults. Available on AbstractActorSystem so extensions can spawn helper actors without depending on a concrete root message type.


[View source]
def spawn(behavior : AbstractBehavior(U), restart_strategy : RestartStrategy, supervision_config : SupervisionConfig, name : String | Nil = nil) : ActorRef(U) forall U #

Spawns an actor under the user guardian with an explicit supervision config.


[View source]
def spawn_system_actor(behavior : AbstractBehavior(T), name : String, restart_strategy : RestartStrategy = RestartStrategy::RESTART, supervision_config : SupervisionConfig = SupervisionConfig.default) : ActorRef(T) forall T #

Spawns a system actor under /system/{name} System actors are internal framework actors (scheduler, dead letters, etc.)


[View source]
def system_actor(name : String, type : T.class) : ActorRefBase forall T #

Convenience method to lookup an actor under /system/{name}


[View source]
def user_actor(name : String, type : T.class) : ActorRefBase forall T #

Convenience method to lookup an actor under /user/{name}


[View source]
def with_spawn_admission(&) #

[View source]