Class: JobDispatch::Sockets::Enqueue
- Inherits:
-
Object
- Object
- JobDispatch::Sockets::Enqueue
- Defined in:
- lib/job_dispatch/sockets/enqueue.rb
Instance Method Summary collapse
-
#initialize(bind_address) ⇒ Enqueue
constructor
A new instance of Enqueue.
- #poll_item ⇒ Object
-
#process ⇒ Object
Enqueue socket when it receives a message simply stores it in the database.
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_item ⇒ Object
8 9 10 |
# File 'lib/job_dispatch/sockets/enqueue.rb', line 8 def poll_item @poll_item ||= ZMQ::Pollitem(@socket, ZMQ::POLLIN) end |
#process ⇒ Object
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 |