Supervisors; with Supervision Containers (Groups), Configurations, and Trees for Celluloid.
To supervise actors, you have many options:
Using supervisors.
Directly
MyActor.supervise as: :my_actor # Without arguments.
MyActor.supervise as: :my_actor, args: [:one_arg, :two_args]
Indirectly
Celluloid.supervise as: :my_actor, type: MyActor # Without arguments.
Celluloid.supervise as: :my_actor, type: MyActor, args: [:one_arg, :two_args]
Using containers.
container = Celluloid::Supervision::Container.new {
supervise type: MyActor, as: :my_actor
supervise type: MyActor, as: :my_actor_with_args, args: [:one_arg, :two_args]
}
container.run!
Using configuration objects:
config = Celluloid::Supervision::Configuration.define([
{
type: MyActor,
as: :my_actor
},
{
type: MyActor,
as: :my_actor_with_args,
args: [
:one_arg,
:two_args
]
},
])
# Whenever you would like to deploy the actors:
config.deploy
# Whenver you would like to shut them down:
config.shutdown
# Reuse the same configuration if you like!
config.deploy
By on-going configuration object:
config = Celluloid::Supervision::Configuration.new
config.define type: MyActor, as: :my_actor
config.define type: MyActor, as: :my_actor_with_args, args: [:one_arg, :two_args]
config deploy
# Now add actors to the already running configuration.
config.add type: MyActor, as: :my_actor_deployed_immediately
config.shutdown
Documentation coming:
- Supervision Trees
- Supervised Pools
- Supervised Supervisors
Contributing
- Fork this repository on github.
- Make your changes and send us a pull request.
- If we like them we'll merge them.
- If we've accepted a patch, feel free to ask for commit access.
License
Copyright (c) 2011-2015 Tony Arcieri, Donovan Keme. Distributed under the MIT License. See LICENSE.txt for further details.