Module: Celluloid::ZMQ

Defined in:
lib/celluloid/zmq.rb,
lib/celluloid/zmq/waker.rb,
lib/celluloid/zmq/mailbox.rb,
lib/celluloid/zmq/reactor.rb,
lib/celluloid/zmq/version.rb

Overview

Actors which run alongside 0MQ sockets

Defined Under Namespace

Classes: DeadWakerError, Mailbox, Reactor, Waker

Constant Summary collapse

VERSION =
"0.0.3"

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.contextObject

Obtain a 0MQ context (or lazily initialize it)



22
23
24
# File 'lib/celluloid/zmq.rb', line 22

def context
  @context ||= ::ZMQ::Context.new(1)
end

Class Method Details

.included(klass) ⇒ Object

Included hook to pull in Celluloid



16
17
18
19
# File 'lib/celluloid/zmq.rb', line 16

def included(klass)
  klass.send :include, ::Celluloid
  klass.use_mailbox Celluloid::ZMQ::Mailbox
end

Instance Method Details

#wait_readable(socket) ⇒ Object

Wait for the given IO object to become readable



28
29
30
31
# File 'lib/celluloid/zmq.rb', line 28

def wait_readable(socket)
  # Law of demeter be damned!
  current_actor.mailbox.reactor.wait_readable(socket)
end

#wait_writeable(socket) ⇒ Object

Wait for the given IO object to become writeable



34
35
36
# File 'lib/celluloid/zmq.rb', line 34

def wait_writeable(socket)
  current_actor.mailbox.reactor.wait_writeable(socket)
end