Method: ActivePublisher.with_exchange
- Defined in:
- lib/active_publisher.rb
.with_exchange(exchange_name) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/active_publisher.rb', line 52 def self.with_exchange(exchange_name) connection = ::ActivePublisher::Connection.connection channel = connection.create_channel begin channel.confirm_select if configuration.publisher_confirms exchange = channel.topic(exchange_name) yield(exchange) channel.wait_for_confirms if configuration.publisher_confirms ensure channel.close rescue nil end end |