Sha256: bc1c3a6481a09f419e1bf94490bcb8e05a9d7aded1c65bcd55e7734aa5073430
Contents?: true
Size: 1.23 KB
Versions: 6
Compression:
Stored size: 1.23 KB
Contents
module Legion module Transport class Exchange < Legion::Transport::CONNECTOR::Exchange include Legion::Transport::Common def initialize(exchange = exchange_name, options = {}) @options = options @type = options[:type] || default_type super(channel, @type, exchange, options_builder(default_options, exchange_options, @options)) rescue ::Bunny::PreconditionFailed, ::Bunny::ChannelAlreadyClosed raise unless @retries.nil? @retries = 1 delete_exchange(exchange) retry end def delete_exchange(exchange) Legion::Logging.warn "Exchange:#{exchange} exists with wrong parameters, deleting and creating" channel.exchange_delete(exchange) end def default_options hash = {} hash[:durable] = true hash[:auto_delete] = false hash[:arguments] = {} hash end def exchange_name self.class.ancestors.first.to_s.split('::')[2].downcase end def exchange_options {} end def delete(options = {}) super(options) true rescue ::Bunny::PreconditionFailed false end def default_type 'topic' end end end end
Version data entries
6 entries across 6 versions & 2 rubygems