Sha256: 2e0f76c6342a51304916f0e1f779e08bcfae94824d1a861eaa7fff5e37d6740f
Contents?: true
Size: 930 Bytes
Versions: 3
Compression:
Stored size: 930 Bytes
Contents
module Pwwka class ChannelConnector attr_reader :connection attr_reader :topic_exchange_name attr_reader :channel # The channel_connector starts the connection to the message_bus # so it should only be instantiated by a method that has a strategy # for closing the connection def initialize configuration = Pwwka.configuration connection_options = {automatically_recover: false}.merge(configuration.options) @connection = Bunny.new(configuration.rabbit_mq_host, connection_options) @topic_exchange_name = configuration.topic_exchange_name @connection.start @channel = @connection.create_channel end def topic_exchange @topic_exchange ||= channel.topic(topic_exchange_name, durable: true) end def connection_close channel.close connection.close end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pwwka-0.2.0 | lib/pwwka/channel_connector.rb |
pwwka-0.1.0 | lib/pwwka/channel_connector.rb |
pwwka-0.0.2 | lib/pwwka/channel_connector.rb |