Celluloid 0.6.0: easy-to-use concurrent objects for Ruby

Celluloidprovides a simple and natural way to build fault-tolerant
concurrent programs in Ruby. WithCelluloid, you can build systems out
of concurrent objects just as easily as you build sequential programs
out of regular objects. Recommended for any developer, including
novices,Celluloidshould help ease your worries about building
multithreaded Ruby programs.

Celluloidwraps objects in threads, allowing them to run concurrently,
while still letting you talk to them using standard Ruby method call
conventions. It also enables asynchronous method calls which tell a
method to do something in the background, and futures, which let you
request a method be executed then check back later for the result.

Celluloid 0.6.0 brings with it one of the most requested features:
applications and supervision trees. Using a simple DSL you can now
list all of the actors in a given library, ensure they’re supervised,
and even supervise the supervisors.

The DSL works as follows:

class MyApplication < Celluloid::Application
  supervise MyActor, :as => :my_actor
  supervise AnotherActor, :as => :another_actor

This defines the actors in your application. When your application is
running, it will create one instance of MyActor and register it as
Celluloid::Actor[:my_actor], and also a single instance of
AnotherActor registered as Celluloid::Actor[:another_actor]

To start the application, run:


This will run in the foreground, waiting for any of the supervisors to
crash and automatically restarting them. To run an application in the
background, run:


Additional changes in Celluloid 0.6.0:

  • Celluloid::Application classes for describing the structure of
    applications built with Celluloid
  • Methods of actors can now participate in the actor protocol directly
    via Celluloid#receive
  • Configure custom mailbox types using Celluloid.use_mailbox
  • Define a custom finalizer for an actor by defining MyActor#finalize
  • Actor.call and Actor.async API for making sync and async calls via
  • Fix bugs in Celluloid::Supervisors which would crash on startup if
    the actor they’re supervising also crashes on startup
  • Add Celluloid.fiber and Celluloid.resume_fiber to allow extension
    APIs to participate in the Celluloid fiber protocol
  • Internal refactoring to better support DCell