Class: Lagomorph::Subscriber
- Inherits:
-
Object
- Object
- Lagomorph::Subscriber
- Defined in:
- lib/lagomorph/subscriber.rb
Instance Method Summary collapse
-
#initialize(worker_class) ⇒ Subscriber
constructor
A new instance of Subscriber.
- #subscribe(queue, channel) ⇒ Object
Constructor Details
#initialize(worker_class) ⇒ Subscriber
Returns a new instance of Subscriber.
6 7 8 |
# File 'lib/lagomorph/subscriber.rb', line 6 def initialize(worker_class) @worker_class = worker_class end |
Instance Method Details
#subscribe(queue, channel) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/lagomorph/subscriber.rb', line 10 def subscribe(queue, channel) queue.subscribe(manual_ack: true, block: false) do |, payload| response = process_request(payload) channel.ack(.delivery_tag) publish_response(channel, , response) end end |