Module: Proletariat::Worker::ConfigurationMethods

Included in:
Proletariat::Worker
Defined in:
lib/proletariat/worker.rb

Overview

Internal: Class methods on Worker to provide configuration DSL.

Instance Method Summary collapse

Instance Method Details

#exception_handler(value = nil) ⇒ Object



91
92
93
94
95
96
97
# File 'lib/proletariat/worker.rb', line 91

def exception_handler(value = nil)
  if value
    @exception_handler = value
  else
    @exception_handler || :exponential_backoff
  end
end

#listen_on(*new_routing_keys) ⇒ Object

Public: A configuration method for adding a routing key to be used when

binding this worker type's queue to an exchange.

routing_key - A routing key for queue-binding as a String.

Returns nil.



105
106
107
108
109
# File 'lib/proletariat/worker.rb', line 105

def listen_on(*new_routing_keys)
  routing_keys.concat new_routing_keys

  nil
end

#routing_keysObject

Internal: Returns the list of all desired routing keys for this worker

type

Returns an Array of routing keys as Strings.



115
116
117
# File 'lib/proletariat/worker.rb', line 115

def routing_keys
  @routing_keys ||= []
end