Class: Pernalonga::PernalongaApi
- Inherits:
-
Object
- Object
- Pernalonga::PernalongaApi
- Defined in:
- lib/pernalonga/pernalonga_api.rb
Instance Method Summary collapse
Instance Method Details
#consume(klass, queue) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/pernalonga/pernalonga_api.rb', line 8 def consume(klass, queue) @klass = klass ch = connect_channel ch.queue(queue) .subscribe(consumer_tag: 'pernalonga', block: true, manual_ack: true) do |delivery_info, , msg = q.pop| klass. msg ch.acknowledge(delivery_info.delivery_tag, false) end end |
#enqueue(queue, message) ⇒ Object
21 22 23 |
# File 'lib/pernalonga/pernalonga_api.rb', line 21 def enqueue(queue, ) connect_channel.queue(queue).publish() end |