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
72 73 74 |
# File 'lib/vx/lib/consumer.rb', line 72 def ack params.ack = true end |
#allocate_pub_channel ⇒ Object
84 85 86 |
# File 'lib/vx/lib/consumer.rb', line 84 def allocate_pub_channel Consumer.session.allocate_pub_channel { yield } end |
#configuration ⇒ Object
88 89 90 |
# File 'lib/vx/lib/consumer.rb', line 88 def configuration Consumer.configuration end |
#content_type(value) ⇒ Object
68 69 70 |
# File 'lib/vx/lib/consumer.rb', line 68 def content_type(value) params.content_type = value end |
#direct ⇒ Object
51 52 53 |
# File 'lib/vx/lib/consumer.rb', line 51 def direct params.exchange_type = :direct end |
#exchange(*args) ⇒ Object
38 39 40 41 |
# File 'lib/vx/lib/consumer.rb', line 38 def exchange(*args) params. = args.last.is_a?(Hash) ? args.pop : nil params.exchange_name = args.first end |
#fanout ⇒ Object
43 44 45 |
# File 'lib/vx/lib/consumer.rb', line 43 def fanout params.exchange_type = :fanout end |
#headers(value) ⇒ Object
64 65 66 |
# File 'lib/vx/lib/consumer.rb', line 64 def headers(value) params.headers = value end |
#model(value) ⇒ Object
76 77 78 |
# File 'lib/vx/lib/consumer.rb', line 76 def model(value) params.model = value end |
#params ⇒ Object
34 35 36 |
# File 'lib/vx/lib/consumer.rb', line 34 def params @params ||= Params.new(self.name) end |
#queue(*args) ⇒ Object
55 56 57 58 |
# File 'lib/vx/lib/consumer.rb', line 55 def queue(*args) params. = args.last.is_a?(Hash) ? args.pop : nil params.queue_name = args.first end |
#routing_key(name) ⇒ Object
60 61 62 |
# File 'lib/vx/lib/consumer.rb', line 60 def routing_key(name) params.routing_key = name end |
#session ⇒ Object
80 81 82 |
# File 'lib/vx/lib/consumer.rb', line 80 def session Consumer.session end |
#topic ⇒ Object
47 48 49 |
# File 'lib/vx/lib/consumer.rb', line 47 def topic params.exchange_type = :topic end |
#with_middlewares(name, env, &block) ⇒ Object
92 93 94 |
# File 'lib/vx/lib/consumer.rb', line 92 def with_middlewares(name, env, &block) Consumer.configuration.builders[name].to_app(block).call(env) end |