Module: Vx::Lib::Consumer::ClassMethods
- Defined in:
- lib/vx/lib/consumer.rb
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 Method Details
#ack ⇒ Object
75 76 77 |
# File 'lib/vx/lib/consumer.rb', line 75 def ack params.ack = true end |
#allocate_pub_channel ⇒ Object
87 88 89 |
# File 'lib/vx/lib/consumer.rb', line 87 def allocate_pub_channel Consumer.session.allocate_pub_channel { yield } end |
#configuration ⇒ Object
91 92 93 |
# File 'lib/vx/lib/consumer.rb', line 91 def configuration Consumer.configuration end |
#content_type(value) ⇒ Object
71 72 73 |
# File 'lib/vx/lib/consumer.rb', line 71 def content_type(value) params.content_type = value end |
#direct ⇒ Object
54 55 56 |
# File 'lib/vx/lib/consumer.rb', line 54 def direct params.exchange_type = :direct end |
#exchange(*args) ⇒ Object
41 42 43 44 |
# File 'lib/vx/lib/consumer.rb', line 41 def exchange(*args) params. = args.last.is_a?(Hash) ? args.pop : nil params.exchange_name = args.first end |
#fanout ⇒ Object
46 47 48 |
# File 'lib/vx/lib/consumer.rb', line 46 def fanout params.exchange_type = :fanout end |
#headers(value) ⇒ Object
67 68 69 |
# File 'lib/vx/lib/consumer.rb', line 67 def headers(value) params.headers = value end |
#model(value) ⇒ Object
79 80 81 |
# File 'lib/vx/lib/consumer.rb', line 79 def model(value) params.model = value end |
#params ⇒ Object
37 38 39 |
# File 'lib/vx/lib/consumer.rb', line 37 def params @params ||= Params.new(self.name) end |
#queue(*args) ⇒ Object
58 59 60 61 |
# File 'lib/vx/lib/consumer.rb', line 58 def queue(*args) params. = args.last.is_a?(Hash) ? args.pop : nil params.queue_name = args.first end |
#routing_key(name) ⇒ Object
63 64 65 |
# File 'lib/vx/lib/consumer.rb', line 63 def routing_key(name) params.routing_key = name end |
#session ⇒ Object
83 84 85 |
# File 'lib/vx/lib/consumer.rb', line 83 def session Consumer.session end |
#topic ⇒ Object
50 51 52 |
# File 'lib/vx/lib/consumer.rb', line 50 def topic params.exchange_type = :topic end |
#with_middlewares(name, env, &block) ⇒ Object
95 96 97 |
# File 'lib/vx/lib/consumer.rb', line 95 def with_middlewares(name, env, &block) Consumer.configuration.builders[name].to_app(block).call(env) end |