Class: Ruote::Resque::Receiver
- Inherits:
-
Ruote::Receiver
- Object
- Ruote::Receiver
- Ruote::Resque::Receiver
- Defined in:
- lib/ruote/resque/receiver.rb
Overview
The receiver will poll the reply_queue in Resque, waiting for reply jobs. It does so in a new thread.
By default it polls the reply_queue every 5 seconds, but this is configurable via
the interval
configuration option. See Ruote::Resque.
You should launch the Receiver as soon as your engine is set up.
Instance Method Summary collapse
-
#handle_error(e) ⇒ void
Called when an error is raised during the poll/reserve/process flow of the Receiver.
-
#initialize(cwes, options = {}) ⇒ Receiver
constructor
Retunrs a new Receiver instance and spawns a worker thread.
-
#shutdown ⇒ void
Stops the worker thread.
Constructor Details
#initialize(cwes, options = {}) ⇒ Receiver
Retunrs a new Receiver instance and spawns a worker thread.
41 42 43 44 |
# File 'lib/ruote/resque/receiver.rb', line 41 def initialize(cwes, = {}) super @listener = listen end |
Instance Method Details
#handle_error(e) ⇒ void
This method returns an undefined value.
Called when an error is raised during the poll/reserve/process flow of the Receiver. You should override this method for custom error handling. By default it just logs the exception.
57 58 59 |
# File 'lib/ruote/resque/receiver.rb', line 57 def handle_error(e) Ruote::Resque.logger.error(e) end |
#shutdown ⇒ void
This method returns an undefined value.
Stops the worker thread.
48 49 50 |
# File 'lib/ruote/resque/receiver.rb', line 48 def shutdown @listener.kill end |