Movie::Extension
Base class for ActorSystem extensions. Extensions provide additional functionality to the actor system (e.g., remoting, clustering, persistence, metrics).
Extensions are:
- Singletons per ActorSystem (one instance per extension type)
- Lazily initialized on first access
- Automatically stopped when the system shuts down
Example: class MyExtension < Movie::Extension def initialize(@system : Movie::AbstractActorSystem) end
def start
# Initialize extension
end
def stop
# Cleanup resources
end
end
Register and use
ext = MyExtension.new(system) system.register_extension(ext) system.extension(MyExtension) # => MyExtension instance
Akka-style access with ExtensionId:
class MyExtId < Movie::ExtensionId(MyExtension) def create(system : Movie::AbstractActorSystem) MyExtension.new(system) end end
MyExtId.get(system) # => MyExtension instance
Instance methods
Called when the extension is registered with the system. Override to perform initialization.
Called when the system is shutting down. Override to cleanup resources (close connections, stop services, etc.)