Class: Fleck::Core::Consumer
- Inherits:
-
Object
- Object
- Fleck::Core::Consumer
- Includes:
- Actions, Base, Configuration, Decorators, HelpersDefiners, Logger, Loggable
- Defined in:
- lib/fleck/core/consumer.rb,
lib/fleck/core/consumer/base.rb,
lib/fleck/core/consumer/logger.rb,
lib/fleck/core/consumer/actions.rb,
lib/fleck/core/consumer/request.rb,
lib/fleck/core/consumer/response.rb,
lib/fleck/core/consumer/decorators.rb,
lib/fleck/core/consumer/validation.rb,
lib/fleck/core/consumer/action_param.rb,
lib/fleck/core/consumer/configuration.rb,
lib/fleck/core/consumer/helpers_definers.rb,
lib/fleck/core/consumer/response_helpers.rb
Overview
Open ‘Consumer` class in order to define consumer helpers
Direct Known Subclasses
Defined Under Namespace
Modules: Actions, Base, Configuration, Decorators, HelpersDefiners, Logger Classes: ActionParam, Request, Response, Validation
Constant Summary
Constants included from HelpersDefiners
HelpersDefiners::INTERRUPT_NAME
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#consumer_id ⇒ Object
Returns the value of attribute consumer_id.
-
#consumer_tag ⇒ Object
Returns the value of attribute consumer_tag.
-
#exchange ⇒ Object
Returns the value of attribute exchange.
-
#publisher ⇒ Object
Returns the value of attribute publisher.
-
#queue ⇒ Object
Returns the value of attribute queue.
-
#request ⇒ Object
Returns the value of attribute request.
-
#subscription ⇒ Object
Returns the value of attribute subscription.
Instance Method Summary collapse
- #deprecated! ⇒ Object
- #headers ⇒ Object
-
#initialize(consumer_id = nil) ⇒ Consumer
constructor
A new instance of Consumer.
- #params ⇒ Object
- #pause ⇒ Object
- #response ⇒ Object
- #resume ⇒ Object
Methods included from Base
Methods included from HelpersDefiners
Methods included from Decorators
Methods included from Configuration
Methods included from Actions
Methods included from Logger
Methods included from Loggable
Constructor Details
#initialize(consumer_id = nil) ⇒ Consumer
Returns a new instance of Consumer.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/fleck/core/consumer.rb', line 37 def initialize(consumer_id = nil) self.consumer_id = consumer_id instance_eval(&self.class.initialize_block) if self.class.initialize_block start if autostart? at_exit do terminate end end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
34 35 36 |
# File 'lib/fleck/core/consumer.rb', line 34 def channel @channel end |
#connection ⇒ Object
Returns the value of attribute connection.
34 35 36 |
# File 'lib/fleck/core/consumer.rb', line 34 def connection @connection end |
#consumer_id ⇒ Object
Returns the value of attribute consumer_id.
34 35 36 |
# File 'lib/fleck/core/consumer.rb', line 34 def consumer_id @consumer_id end |
#consumer_tag ⇒ Object
Returns the value of attribute consumer_tag.
34 35 36 |
# File 'lib/fleck/core/consumer.rb', line 34 def consumer_tag @consumer_tag end |
#exchange ⇒ Object
Returns the value of attribute exchange.
34 35 36 |
# File 'lib/fleck/core/consumer.rb', line 34 def exchange @exchange end |
#publisher ⇒ Object
Returns the value of attribute publisher.
34 35 36 |
# File 'lib/fleck/core/consumer.rb', line 34 def publisher @publisher end |
#queue ⇒ Object
Returns the value of attribute queue.
34 35 36 |
# File 'lib/fleck/core/consumer.rb', line 34 def queue @queue end |
#request ⇒ Object
Returns the value of attribute request.
34 35 36 |
# File 'lib/fleck/core/consumer.rb', line 34 def request @request end |
#subscription ⇒ Object
Returns the value of attribute subscription.
34 35 36 |
# File 'lib/fleck/core/consumer.rb', line 34 def subscription @subscription end |
Instance Method Details
#deprecated! ⇒ Object
72 73 74 75 76 |
# File 'lib/fleck/core/consumer.rb', line 72 def deprecated! logger.warn "DEPRECATION: the method `#{caller_locations(1, 1)[0].label}` is going to be deprecated. " \ 'Please, consider using a newer version of this method.' response&.deprecated! end |
#headers ⇒ Object
60 61 62 |
# File 'lib/fleck/core/consumer.rb', line 60 def headers request.headers end |
#params ⇒ Object
64 65 66 |
# File 'lib/fleck/core/consumer.rb', line 64 def params request.params end |
#pause ⇒ Object
49 50 51 52 53 54 |
# File 'lib/fleck/core/consumer.rb', line 49 def pause return if subscription.nil? || channel.nil? || channel.closed? cancel_ok = subscription.cancel self.consumer_tag = cancel_ok.consumer_tag end |
#response ⇒ Object
68 69 70 |
# File 'lib/fleck/core/consumer.rb', line 68 def response request.response end |
#resume ⇒ Object
56 57 58 |
# File 'lib/fleck/core/consumer.rb', line 56 def resume subscribe! end |