class JobDispatch::Signaller

This class represents a ZeroMQ socket for signalling to the broker that there are jobs immediately available.

Attributes

socket[R]

Public Class Methods

new(wakeup_connect_address) click to toggle source
# File lib/job_dispatch/signaller.rb, line 7
def initialize(wakeup_connect_address)
  @wakeup_connect_address = wakeup_connect_address
end

Public Instance Methods

connect() click to toggle source
# File lib/job_dispatch/signaller.rb, line 11
def connect
  if @socket.nil?
    @socket = JobDispatch.context.socket(ZMQ::PUB)
    @socket.connect(@wakeup_connect_address)
  end
end
disconnect() click to toggle source
# File lib/job_dispatch/signaller.rb, line 18
def disconnect
  if @socket
    @socket.close
    @socket = nil
  end
end
signal(queue='default') click to toggle source

signals are a straight

# File lib/job_dispatch/signaller.rb, line 26
def signal(queue='default')
  @socket.send(queue)
end