Module: Vx::Lib::Consumer::ClassMethods
- Defined in:
- lib/vx/lib/consumer.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
- #ack ⇒ Object
- #allocate_pub_channel ⇒ Object
- #configuration ⇒ Object
- #content_type(value) ⇒ Object
- #direct ⇒ Object
- #exchange(*args) ⇒ Object
- #fanout ⇒ Object
- #headers(value) ⇒ Object
- #model(value) ⇒ Object
- #params ⇒ Object
- #queue(*args) ⇒ Object
- #routing_key(name) ⇒ Object
- #session ⇒ Object
- #topic ⇒ Object
- #with_middlewares(name, env, &block) ⇒ Object
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
34 35 36 |
# File 'lib/vx/lib/consumer.rb', line 34 def logger @logger end |
Instance Method Details
#ack ⇒ Object
74 75 76 |
# File 'lib/vx/lib/consumer.rb', line 74 def ack params.ack = true end |
#allocate_pub_channel ⇒ Object
86 87 88 |
# File 'lib/vx/lib/consumer.rb', line 86 def allocate_pub_channel Consumer.session.allocate_pub_channel { yield } end |
#configuration ⇒ Object
90 91 92 |
# File 'lib/vx/lib/consumer.rb', line 90 def configuration Consumer.configuration end |
#content_type(value) ⇒ Object
70 71 72 |
# File 'lib/vx/lib/consumer.rb', line 70 def content_type(value) params.content_type = value end |
#direct ⇒ Object
53 54 55 |
# File 'lib/vx/lib/consumer.rb', line 53 def direct params.exchange_type = :direct end |
#exchange(*args) ⇒ Object
40 41 42 43 |
# File 'lib/vx/lib/consumer.rb', line 40 def exchange(*args) params. = args.last.is_a?(Hash) ? args.pop : nil params.exchange_name = args.first end |
#fanout ⇒ Object
45 46 47 |
# File 'lib/vx/lib/consumer.rb', line 45 def fanout params.exchange_type = :fanout end |
#headers(value) ⇒ Object
66 67 68 |
# File 'lib/vx/lib/consumer.rb', line 66 def headers(value) params.headers = value end |
#model(value) ⇒ Object
78 79 80 |
# File 'lib/vx/lib/consumer.rb', line 78 def model(value) params.model = value end |
#params ⇒ Object
36 37 38 |
# File 'lib/vx/lib/consumer.rb', line 36 def params @params ||= Params.new(self.name) end |
#queue(*args) ⇒ Object
57 58 59 60 |
# File 'lib/vx/lib/consumer.rb', line 57 def queue(*args) params. = args.last.is_a?(Hash) ? args.pop : nil params.queue_name = args.first end |
#routing_key(name) ⇒ Object
62 63 64 |
# File 'lib/vx/lib/consumer.rb', line 62 def routing_key(name) params.routing_key = name end |
#session ⇒ Object
82 83 84 |
# File 'lib/vx/lib/consumer.rb', line 82 def session Consumer.session end |
#topic ⇒ Object
49 50 51 |
# File 'lib/vx/lib/consumer.rb', line 49 def topic params.exchange_type = :topic end |
#with_middlewares(name, env, &block) ⇒ Object
94 95 96 |
# File 'lib/vx/lib/consumer.rb', line 94 def with_middlewares(name, env, &block) Consumer.configuration.builders[name].to_app(block).call(env) end |