From 95ba94212c6cac1fb67270df467f5552c54d2213 Mon Sep 17 00:00:00 2001 From: Dmitry Zenovich Date: Tue, 26 Apr 2016 01:51:22 +0300 Subject: [PATCH 1/4] support durable exchanges --- lib/action_subscriber/route_set.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/action_subscriber/route_set.rb b/lib/action_subscriber/route_set.rb index 8aad481..89515a3 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.durable) queue = channel.queue(route.queue, :durable => route.durable) queue.bind(exchange, :routing_key => route.routing_key) queue From 20b884048306f5f5b077488aa3c768a81a8d85dc Mon Sep 17 00:00:00 2001 From: Dmitry Zenovich Date: Wed, 27 Apr 2016 19:03:25 +0300 Subject: [PATCH 2/4] Update route_set.rb Use another configuration parameter for specifying durability of the exchanges. --- lib/action_subscriber/route_set.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/action_subscriber/route_set.rb b/lib/action_subscriber/route_set.rb index 89515a3..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, :durable => route.durable) + 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 From 8bee3cf6223835baf901b3a5fe44ac3f3059709c Mon Sep 17 00:00:00 2001 From: Dmitry Zenovich Date: Wed, 27 Apr 2016 19:05:55 +0300 Subject: [PATCH 3/4] Update route.rb Use another configuration parameter for specifying durability of the exchanges --- lib/action_subscriber/route.rb | 2 ++ 1 file changed, 2 insertions(+) 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) From 4b4518e68bf32dc71f7a6aa5a0fba51e50d34c7a Mon Sep 17 00:00:00 2001 From: Dmitry Zenovich Date: Wed, 27 Apr 2016 19:11:28 +0300 Subject: [PATCH 4/4] Update router.rb Use another configuration parameter for specifying durability of the exchanges --- lib/action_subscriber/router.rb | 1 + 1 file changed, 1 insertion(+) 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)