Class: BaseRabbitMQRoom
- Inherits:
-
Object
- Object
- BaseRabbitMQRoom
- Defined in:
- lib/postcard_rb/dispatchers/RabbitMQ/routings/BaseRabbitMQRoom.rb
Direct Known Subclasses
ExplicitRabbitMQRoom, PatternMatchingRabbitMQRoom, WideRabbitMQRoom
Instance Method Summary collapse
-
#initialize(channel:, queue:, exclusive: false) ⇒ BaseRabbitMQRoom
constructor
A new instance of BaseRabbitMQRoom.
- #subscribe(block: true) ⇒ Object
Constructor Details
#initialize(channel:, queue:, exclusive: false) ⇒ BaseRabbitMQRoom
Returns a new instance of BaseRabbitMQRoom.
4 5 6 7 8 |
# File 'lib/postcard_rb/dispatchers/RabbitMQ/routings/BaseRabbitMQRoom.rb', line 4 def initialize channel:, queue:, exclusive: false @channel = channel @queue = queue @exclusive = exclusive end |
Instance Method Details
#subscribe(block: true) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/postcard_rb/dispatchers/RabbitMQ/routings/BaseRabbitMQRoom.rb', line 10 def subscribe block: true begin manual_ack = false manual_ack = true if @exclusive @queue.subscribe(manual_ack: manual_ack, block: block) do |delivery_info, properties, payload| yield delivery_info, properties, payload @channel.ack(delivery_info.delivery_tag) if @exclusive end rescue Interrupt => _ end end |