Class: Hoth::Transport::Beanstalkd
- Defined in:
- lib/hoth/transport/beanstalkd.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Attributes inherited from Base
Instance Method Summary collapse
- #call_remote_with(*args) ⇒ Object
-
#initialize(*args) ⇒ Beanstalkd
constructor
A new instance of Beanstalkd.
- #tube_name ⇒ Object
Constructor Details
#initialize(*args) ⇒ Beanstalkd
Returns a new instance of Beanstalkd.
14 15 16 17 |
# File 'lib/hoth/transport/beanstalkd.rb', line 14 def initialize(*args) super @connection = Beanstalk::Connection.new("#{endpoint.host}:#{endpoint.port}") end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
12 13 14 |
# File 'lib/hoth/transport/beanstalkd.rb', line 12 def connection @connection end |
Instance Method Details
#call_remote_with(*args) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/hoth/transport/beanstalkd.rb', line 19 def call_remote_with(*args) connection.use(tube_name) begin encoded_args = encoder.encode(args) Hoth::Logger.debug "encoded_args: #{encoded_args}" connection.put encoded_args rescue => e Hoth::Logger.warn "An error occured while sending a payload to beanstalkd: #{e.message}" end end |
#tube_name ⇒ Object
31 32 33 |
# File 'lib/hoth/transport/beanstalkd.rb', line 31 def tube_name @tube_name ||= "#{self.module.name}/#{name}".dasherize end |