Class: Cod::Beanstalk::Service::Control
- Inherits:
-
Object
- Object
- Cod::Beanstalk::Service::Control
- Defined in:
- lib/cod/beanstalk/service.rb
Instance Method Summary collapse
-
#bury ⇒ void
Buries the message for later inspection.
-
#command_issued? ⇒ Boolean
Returns true if a flow control command has already been given as answer to the current request.
-
#delete ⇒ void
Deletes the request.
-
#initialize(channel_control) ⇒ Control
constructor
A new instance of Control.
- #msg_id ⇒ Object
-
#retry ⇒ void
Releases the request for immediate consumption by someone else.
-
#retry_in(seconds) ⇒ void
Releases the request and instructs the beanstalkd server to hand it to us again in seconds seconds.
Constructor Details
#initialize(channel_control) ⇒ Control
Returns a new instance of Control.
30 31 32 |
# File 'lib/cod/beanstalk/service.rb', line 30 def initialize(channel_control) @channel_control = channel_control end |
Instance Method Details
#bury ⇒ void
This method returns an undefined value.
Buries the message for later inspection. (see beanstalkd manual)
60 61 62 |
# File 'lib/cod/beanstalk/service.rb', line 60 def bury @channel_control.bury end |
#command_issued? ⇒ Boolean
Returns true if a flow control command has already been given as answer to the current request. Multiple flow control commands are not allowed.
77 78 79 |
# File 'lib/cod/beanstalk/service.rb', line 77 def command_issued? @channel_control.command_given? end |
#delete ⇒ void
This method returns an undefined value.
Deletes the request. This is how you accept a request.
68 69 70 |
# File 'lib/cod/beanstalk/service.rb', line 68 def delete @channel_control.delete end |
#msg_id ⇒ Object
81 82 83 |
# File 'lib/cod/beanstalk/service.rb', line 81 def msg_id @channel_control.msg_id end |
#retry ⇒ void
This method returns an undefined value.
Releases the request for immediate consumption by someone else.
52 53 54 |
# File 'lib/cod/beanstalk/service.rb', line 52 def retry @channel_control.release end |
#retry_in(seconds) ⇒ void
This method returns an undefined value.
Releases the request and instructs the beanstalkd server to hand it to us again in seconds seconds.
40 41 42 43 44 45 46 |
# File 'lib/cod/beanstalk/service.rb', line 40 def retry_in(seconds) fail ArgumentError, "#retry_in accepts only an integer number of seconds." \ unless seconds.floor == seconds @channel_control.release_with_delay(seconds) end |