Class: Cod::Beanstalk::Service::Control

Inherits:
Object
  • Object
show all
Defined in:
lib/cod/beanstalk/service.rb

Instance Method Summary collapse

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

#buryvoid

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.

Returns:

  • (Boolean)


77
78
79
# File 'lib/cod/beanstalk/service.rb', line 77

def command_issued?
  @channel_control.command_given?
end

#deletevoid

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_idObject



81
82
83
# File 'lib/cod/beanstalk/service.rb', line 81

def msg_id
  @channel_control.msg_id
end

#retryvoid

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.

Parameters:

  • seconds (Fixnum)


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