action_subscriber 2.3.0.pre0-java → 2.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e5f32fb2592f92921505490fe5004de2afb48872
4
- data.tar.gz: efba0fd70d9a4b7a8c49b736c0975720824d5bad
3
+ metadata.gz: 4f88273356427bd1dd6eb0a7193439582c4459a3
4
+ data.tar.gz: 1e7dbaf3d4910fa57f2827d9813f283b96f40b4c
5
5
  SHA512:
6
- metadata.gz: 51403c9c49f7e7223c1e2d95934b0848d09c210ea05e1ebda69d01d18494fc318934d631b73532d84891be0574f936c2dc8cc1c73b00f684720d10561874c3a3
7
- data.tar.gz: e8d38d36f90243040892b98691c671f54afc21621fda9c30bfd99bde81588dfac295682272788fc0d0d63af5c3e4171d1dd08ba2f81760df45d0b0203f14c8ca
6
+ metadata.gz: 0f22d17d74aa6ad323d72c531668e47e4b19d003ada7c4b4a2a315ad4c252a6336dc27aad123360939370da80b9f6fb10d4c5168da07d94eaaa7e9754a16151c
7
+ data.tar.gz: dc5dff440bc611ddbc5124baf8023ec44cc0cebf39c1127d32d66d9a836c61c27b266f6a21516987c4a578e09649b32764aaacddf0ca7e2bccb4cdd295308721
data/README.md CHANGED
@@ -72,7 +72,7 @@ ActionSubscriber needs to know how to connect to your rabbit server to start get
72
72
 
73
73
  In an initializer, you can set the host and the port like this :
74
74
 
75
- ActionSubscriber::Configuration.configure do |config|
75
+ ActionSubscriber.configure do |config|
76
76
  config.hosts = ["rabbit1", "rabbit2", "rabbit3"]
77
77
  config.port = 5672
78
78
  end
@@ -8,6 +8,7 @@ module ActionSubscriber
8
8
  routes << ActionSubscriber::Route.new({
9
9
  acknowledgements: acknowledge_messages?,
10
10
  action: method_name,
11
+ durable: false,
11
12
  exchange: exchange_name,
12
13
  routing_key: routing_key_name_for_method(method_name),
13
14
  subscriber: self,
@@ -2,6 +2,7 @@ module ActionSubscriber
2
2
  class Route
3
3
  attr_reader :acknowledgements,
4
4
  :action,
5
+ :durable,
5
6
  :exchange,
6
7
  :prefetch,
7
8
  :queue,
@@ -12,6 +13,7 @@ module ActionSubscriber
12
13
  def initialize(attributes)
13
14
  @acknowledgements = attributes.fetch(:acknowledgements)
14
15
  @action = attributes.fetch(:action)
16
+ @durable = attributes.fetch(:durable)
15
17
  @exchange = attributes.fetch(:exchange).to_s
16
18
  @prefetch = attributes.fetch(:prefetch) { ::ActionSubscriber.config.prefetch }
17
19
  @queue = attributes.fetch(:queue)
@@ -27,7 +27,7 @@ module ActionSubscriber
27
27
  def setup_queue(route)
28
28
  channel = ::ActionSubscriber::RabbitConnection.subscriber_connection.create_channel
29
29
  exchange = channel.topic(route.exchange)
30
- queue = channel.queue(route.queue)
30
+ queue = channel.queue(route.queue, :durable => route.durable)
31
31
  queue.bind(exchange, :routing_key => route.routing_key)
32
32
  queue
33
33
  end
@@ -8,6 +8,7 @@ module ActionSubscriber
8
8
 
9
9
  DEFAULT_SETTINGS = {
10
10
  :acknowledgements => false,
11
+ :durable => false,
11
12
  :exchange => "events",
12
13
  }.freeze
13
14
 
@@ -1,3 +1,3 @@
1
1
  module ActionSubscriber
2
- VERSION = "2.3.0.pre0"
2
+ VERSION = "2.4.0"
3
3
  end
data/routing.md CHANGED
@@ -34,6 +34,7 @@ The `route` method supports the following options:
34
34
 
35
35
  * `acknowledgements` this toggles whether this route is expected to provide an acknowledgment (default `false`)
36
36
  * This is the equivalent of calling `at_most_once!`, `at_least_once!` or `manual_acknowledgement!` in your subscriber class
37
+ * `durable` specifies whether the queue for this route should be a durable (default `false`)
37
38
  * `exchange` specify which exchange you expect messages to be published to (default `"events"`)
38
39
  * This is the equivalent of calling `exchange :actions` in your subscriber
39
40
  * `publisher` this will prefix your queue and routing key with the publishers name
@@ -9,6 +9,7 @@ describe ActionSubscriber::Router do
9
9
  expect(routes.first.acknowledgements).to eq(false)
10
10
  expect(routes.first.action).to eq(:foo)
11
11
  expect(routes.first.exchange).to eq("events")
12
+ expect(routes.first.durable).to eq(false)
12
13
  expect(routes.first.routing_key).to eq("fake.foo")
13
14
  expect(routes.first.subscriber).to eq(FakeSubscriber)
14
15
  expect(routes.first.queue).to eq("alice.fake.foo")
@@ -22,6 +23,7 @@ describe ActionSubscriber::Router do
22
23
  expect(routes.first.acknowledgements).to eq(false)
23
24
  expect(routes.first.action).to eq(:bluff)
24
25
  expect(routes.first.exchange).to eq("events")
26
+ expect(routes.first.durable).to eq(false)
25
27
  expect(routes.first.routing_key).to eq("amigo.fake.bluff")
26
28
  expect(routes.first.subscriber).to eq(FakeSubscriber)
27
29
  expect(routes.first.queue).to eq("alice.amigo.fake.bluff")
@@ -35,6 +37,7 @@ describe ActionSubscriber::Router do
35
37
  expect(routes.first.acknowledgements).to eq(false)
36
38
  expect(routes.first.action).to eq(:crashed)
37
39
  expect(routes.first.exchange).to eq("actions")
40
+ expect(routes.first.durable).to eq(false)
38
41
  expect(routes.first.routing_key).to eq("fake.crashed")
39
42
  expect(routes.first.subscriber).to eq(FakeSubscriber)
40
43
  expect(routes.first.queue).to eq("alice.fake.crashed")
@@ -48,6 +51,21 @@ describe ActionSubscriber::Router do
48
51
  expect(routes.first.acknowledgements).to eq(true)
49
52
  expect(routes.first.action).to eq(:foo)
50
53
  expect(routes.first.exchange).to eq("events")
54
+ expect(routes.first.durable).to eq(false)
55
+ expect(routes.first.routing_key).to eq("fake.foo")
56
+ expect(routes.first.subscriber).to eq(FakeSubscriber)
57
+ expect(routes.first.queue).to eq("alice.fake.foo")
58
+ end
59
+
60
+ it "can specify a queue is durable" do
61
+ routes = described_class.draw_routes do
62
+ route FakeSubscriber, :foo, :durable => true
63
+ end
64
+
65
+ expect(routes.first.acknowledgements).to eq(false)
66
+ expect(routes.first.action).to eq(:foo)
67
+ expect(routes.first.exchange).to eq("events")
68
+ expect(routes.first.durable).to eq(true)
51
69
  expect(routes.first.routing_key).to eq("fake.foo")
52
70
  expect(routes.first.subscriber).to eq(FakeSubscriber)
53
71
  expect(routes.first.queue).to eq("alice.fake.foo")
@@ -71,6 +89,7 @@ describe ActionSubscriber::Router do
71
89
  expect(routes.first.acknowledgements).to eq(false)
72
90
  expect(routes.first.action).to eq(:foo)
73
91
  expect(routes.first.exchange).to eq("events")
92
+ expect(routes.first.durable).to eq(false)
74
93
  expect(routes.first.routing_key).to eq("russell.fake.foo")
75
94
  expect(routes.first.subscriber).to eq(FakeSubscriber)
76
95
  expect(routes.first.queue).to eq("i-am-your-father")
@@ -84,6 +103,7 @@ describe ActionSubscriber::Router do
84
103
  expect(routes.first.acknowledgements).to eq(false)
85
104
  expect(routes.first.action).to eq(:foo)
86
105
  expect(routes.first.exchange).to eq("events")
106
+ expect(routes.first.durable).to eq(false)
87
107
  expect(routes.first.routing_key).to eq("make.it.so")
88
108
  expect(routes.first.subscriber).to eq(FakeSubscriber)
89
109
  expect(routes.first.queue).to eq("alice.russell.fake.foo")
@@ -107,12 +127,14 @@ describe ActionSubscriber::Router do
107
127
  expect(routes.first.acknowledgements).to eq(true)
108
128
  expect(routes.first.action).to eq(:bright)
109
129
  expect(routes.first.exchange).to eq("party")
130
+ expect(routes.first.durable).to eq(false)
110
131
  expect(routes.first.routing_key).to eq("tommy.sparkle.bright")
111
132
  expect(routes.first.subscriber).to eq(SparkleSubscriber)
112
133
  expect(routes.first.queue).to eq("alice.tommy.sparkle.bright")
113
134
  expect(routes.last.acknowledgements).to eq(true)
114
135
  expect(routes.last.action).to eq(:dim)
115
136
  expect(routes.last.exchange).to eq("party")
137
+ expect(routes.last.durable).to eq(false)
116
138
  expect(routes.last.routing_key).to eq("tommy.sparkle.dim")
117
139
  expect(routes.last.subscriber).to eq(SparkleSubscriber)
118
140
  expect(routes.last.queue).to eq("alice.tommy.sparkle.dim")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_subscriber
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0.pre0
4
+ version: 2.4.0
5
5
  platform: java
6
6
  authors:
7
7
  - Brian Stien
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-02-24 00:00:00.000000000 Z
15
+ date: 2016-04-11 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  requirement: !ruby/object:Gem::Requirement
@@ -271,12 +271,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
271
  version: '0'
272
272
  required_rubygems_version: !ruby/object:Gem::Requirement
273
273
  requirements:
274
- - - ">"
274
+ - - ">="
275
275
  - !ruby/object:Gem::Version
276
- version: 1.3.1
276
+ version: '0'
277
277
  requirements: []
278
278
  rubyforge_project:
279
- rubygems_version: 2.4.8
279
+ rubygems_version: 2.5.0
280
280
  signing_key:
281
281
  specification_version: 4
282
282
  summary: ActionSubscriber is a DSL that allows a rails app to consume messages from a RabbitMQ broker.