diff --git a/lib/action_subscriber/route.rb b/lib/action_subscriber/route.rb index cf7cd05..5b9d961 100644 --- a/lib/action_subscriber/route.rb +++ b/lib/action_subscriber/route.rb @@ -4,6 +4,7 @@ class Route :action, :durable, :exchange, + :exchange_durable, :prefetch, :queue, :routing_key, @@ -15,6 +16,7 @@ def initialize(attributes) @action = attributes.fetch(:action) @durable = attributes.fetch(:durable) @exchange = attributes.fetch(:exchange).to_s + @exchange_durable = attributes.fetch(:exchange_durable) @prefetch = attributes.fetch(:prefetch) { ::ActionSubscriber.config.prefetch } @queue = attributes.fetch(:queue) @routing_key = attributes.fetch(:routing_key) diff --git a/lib/action_subscriber/route_set.rb b/lib/action_subscriber/route_set.rb index 8aad481..325c15e 100644 --- a/lib/action_subscriber/route_set.rb +++ b/lib/action_subscriber/route_set.rb @@ -26,7 +26,7 @@ def queues def setup_queue(route) channel = ::ActionSubscriber::RabbitConnection.subscriber_connection.create_channel - exchange = channel.topic(route.exchange) + exchange = channel.topic(route.exchange, :durable => route.exchange_durable) queue = channel.queue(route.queue, :durable => route.durable) queue.bind(exchange, :routing_key => route.routing_key) queue diff --git a/lib/action_subscriber/router.rb b/lib/action_subscriber/router.rb index ce4e540..0e210bc 100644 --- a/lib/action_subscriber/router.rb +++ b/lib/action_subscriber/router.rb @@ -10,6 +10,7 @@ def self.draw_routes(&block) :acknowledgements => false, :durable => false, :exchange => "events", + :exchange_durable => false }.freeze def default_routing_key_for(route_settings)