Module: Hutch::Consumer

Defined in:
lib/hutch/consumer.rb

Overview

Include this module in a class to register it as a consumer. Consumers gain a class method called ‘consume`, which should be used to register the routing keys a consumer is interested in.

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#brokerObject

Returns the value of attribute broker.



8
9
10
# File 'lib/hutch/consumer.rb', line 8

def broker
  @broker
end

#delivery_infoObject

Returns the value of attribute delivery_info.



8
9
10
# File 'lib/hutch/consumer.rb', line 8

def delivery_info
  @delivery_info
end

Class Method Details

.included(base) ⇒ Object



10
11
12
13
# File 'lib/hutch/consumer.rb', line 10

def self.included(base)
  base.extend(ClassMethods)
  Hutch.register_consumer(base)
end

Instance Method Details

#loggerObject



23
24
25
# File 'lib/hutch/consumer.rb', line 23

def logger
  Hutch::Logging.logger
end

#reject!Object



15
16
17
# File 'lib/hutch/consumer.rb', line 15

def reject!
  broker.reject(delivery_info.delivery_tag)
end

#requeue!Object



19
20
21
# File 'lib/hutch/consumer.rb', line 19

def requeue!
  broker.requeue(delivery_info.delivery_tag)
end