Class: JobDispatch::Sockets::Enqueue

Inherits:
Object
  • Object
show all
Defined in:
lib/job_dispatch/sockets/enqueue.rb

Instance Method Summary collapse

Constructor Details

#initialize(bind_address) ⇒ Enqueue

Returns a new instance of Enqueue.



3
4
5
6
# File 'lib/job_dispatch/sockets/enqueue.rb', line 3

def initialize(bind_address)
  @socket = JobDispatch.context.socket(ZMQ::REQ)
  @socket.bind(bind_address)
end

Instance Method Details

#poll_itemObject



8
9
10
# File 'lib/job_dispatch/sockets/enqueue.rb', line 8

def poll_item
  @poll_item ||= ZMQ::Pollitem(@socket, ZMQ::POLLIN)
end

#processObject

Enqueue socket when it receives a message simply stores it in the database. It will also send a message to wake a connected dispatcher



14
15
16
# File 'lib/job_dispatch/sockets/enqueue.rb', line 14

def process

end