Celluloid/celluloid-io/celluloid-zmq/dcell 0.9.0: Actors for Ruby

Celluloidis an easy-to-use library for building fault-tolerant
concurrent programs in Ruby:

Celluloid::IO provides evented I/O for Celluloid actors, similar to
EventMachine but with a synchronous API:

DCell lets you build distributed actor systems ala DRb that talk over
the 0MQ protocol, using theCelluloid::ZMQ library:


Celluloid 0.9.0 contains some of the most requested features:

  • Celluloid::Pool provides round-robin load distribution across
    configurable pool sizes
  • Celluloid now attempts a graceful shutdown of all actors at exit
  • Celluloid#exclusive prevents Fiber-switching during calls
  • Celluloid.exception_handler { |ex| … } lets you hook into custom
    error reporting tools like Airbrake

Celluloid::IO 0.9.0 represents the first “real” release of this
library and is in a generally usable state for servers. This release
introduces three new classes:

  • Celluloid::IO::TCPServer
  • Celluloid::IO::TCPSocket
  • Celluloid::IO::UDPSocket

These classes have partial duck-type compatibility with their cousins
from the Ruby standard library. They provide non-blocking “evented” IO
inside of Celluloid::IO actors, and blocking IO everywhere else.

This means unlike EventMachine, you don’t have to rewrite every single
library in a callback-driven style to take advantage of non-blocking
I/O. With a small change to support injection of a custom socket type,
any library presently written using the socket types from the Ruby
standard library can take advantage of nonblocking “evented” IO.

A proof-of-concept web server written with Celluloid::IO is available

Celluloid::ZMQ 0.9.0 contains a brand-new API which wraps ffi-rzmq in
a similar manner to the way Celluloid::IO wraps Ruby’s standard
sockets. 0MQ sockets automatically take advantage of non-blocking
evented behavior inside of Celluloid::ZMQ actors.

Each of the 0MQ socket types now has its own class:

  • Celluloid::ZMQ::PushSocket
  • Celluloid::ZMQ::PullSocket
  • Celluloid::ZMQ::ReqSocket
  • Celluloid::ZMQ::RepSocket
  • Celluloid::ZMQ::PubSocket
  • Celluloid::ZMQ::SubSocket

DCell 0.9.0 doesn’t contain any major new features or functionality,
but does contain updates to use the new Celluloid::ZMQ API.

Full changelogs follow:

Celluloid 0.9.0:

  • Celluloid::Pool supervises pools of actors
  • Graceful shutdown which calls #terminate on all actors
  • Celluloid::Actor.all returns all running actors
  • Celluloid#exclusive runs a high priority block which prevents other
    from executing
  • Celluloid.exception_handler { |ex| … } defines a callback for
    exceptions (for use with Airbrake, exception_notifier, etc.)

Celluloid::IO 0.9.0:

  • TCPServer, TCPSocket, and UDPSocket classes in Celluloid::IO namespace
    with both evented and blocking I/O support
  • Celluloid::IO::Mailbox.new now takes a single parameter to specify an
    alternative reactor (e.g. Celluloid::ZMQ::Reactor)

Celluloid::ZMQ 0.9.0:

  • New 0MQ APIs which wrap ffi-rzmq’s
  • Terminate the 0MQ context at shutdown
  • Use Celluloid::IO 0.9.0’s reactor injection support so we no longer
    have to
    subclass Celluloid::IO::Mailbox

DCell 0.9.0:

  • Use new Celluloid::ZMQ APIs