Class: ActiveMessaging::Adapters::Beanstalk::Message

Inherits:
BaseMessage
  • Object
show all
Defined in:
lib/activemessaging/adapters/beanstalk.rb

Instance Attribute Summary collapse

Attributes inherited from BaseMessage

#body, #destination, #headers, #id

Instance Method Summary collapse

Methods inherited from BaseMessage

#dup, #matches_subscription?, #to_s

Constructor Details

#initialize(beanstalk_job) ⇒ Message

Returns a new instance of Message.



67
68
69
70
71
72
73
74
75
76
# File 'lib/activemessaging/adapters/beanstalk.rb', line 67

def initialize beanstalk_job
  bsh = {
    'destination' => beanstalk_job.stats['tube'],
    'priority'    => beanstalk_job.pri,
    'delay'       => beanstalk_job.delay,
    'ttr'         => beanstalk_job.ttr
  }
  super(beanstalk_job.body, beanstalk_job.id, bsh, beanstalk_job.stats['tube'])
  @beanstalk_job = beanstalk_job
end

Instance Attribute Details

#beanstalk_jobObject

Returns the value of attribute beanstalk_job.



65
66
67
# File 'lib/activemessaging/adapters/beanstalk.rb', line 65

def beanstalk_job
  @beanstalk_job
end

Instance Method Details

#deleteObject



78
79
80
# File 'lib/activemessaging/adapters/beanstalk.rb', line 78

def delete
  @beanstalk_job.delete
end

#releaseObject



82
83
84
# File 'lib/activemessaging/adapters/beanstalk.rb', line 82

def release
  @beanstalk_job.release
end