action_subscriber 2.5.0.pre → 2.5.0.pre2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbba2d8f10337f7f4ed5b07d542d3fab0c7a822c
4
- data.tar.gz: 37813575c5a5c88b61bdd99594794b649e8b82df
3
+ metadata.gz: 85dc20de7aa4e917f499156bb94d4b2e40b9ed12
4
+ data.tar.gz: 7f34bea3b45e1e230cbc55e4e432540094c6241a
5
5
  SHA512:
6
- metadata.gz: 8e838f5d455228a31af45060733e8a5b471c8c8e1be88e98804ba10cdee347d0647019c34fff9f269947812430ab042922261be6f9555912ebd445fc01e921ac
7
- data.tar.gz: 6bf2c26d643c144cee46696888ef072037577b960ac5608246aa7103ff14ed82b32dde9d03aca50311663e599b6c1b22da1f8d08227b9cb5daf6239966f43f58
6
+ metadata.gz: c2b3f863edc1609bc43f403b519cb05c62a7b4dc7e7b8f2048d076fdb7d4523271bd742e3006f67e50b34360c2ac357dc773771e1e0b6d321450e941effed54f
7
+ data.tar.gz: a4261aa2255ad0eb865a1d3e64b0249ea0fac3b91a103301f337ca715777913ff7e1e2a1fe13b6f69a2b2cfcf1bc2d8fb87018c0653fc2ec0e73738cda6e594c
@@ -3,8 +3,8 @@ rvm:
3
3
  - 2.2.4
4
4
  - 2.3.0
5
5
  - jruby-9.0.4.0
6
+ - jruby-9.1.5.0
6
7
  - jruby-head
7
- - rbx-2
8
8
  services:
9
9
  - rabbitmq
10
10
  sudo: false
@@ -12,4 +12,3 @@ cache: bundler
12
12
  matrix:
13
13
  allow_failures:
14
14
  - rvm: jruby-head
15
- - rvm: rbx-2
@@ -27,6 +27,7 @@ require "action_subscriber/march_hare/subscriber"
27
27
  require "action_subscriber/babou"
28
28
  require "action_subscriber/publisher"
29
29
  require "action_subscriber/publisher/async"
30
+ require "action_subscriber/synchronizer"
30
31
  require "action_subscriber/route"
31
32
  require "action_subscriber/route_set"
32
33
  require "action_subscriber/router"
@@ -11,6 +11,10 @@ module ActionSubscriber
11
11
  bunny_consumers.each(&:cancel)
12
12
  end
13
13
 
14
+ def create_queue(channel, queue_name, queue_options)
15
+ ::Bunny::Queue.new(channel, queue_name, queue_options)
16
+ end
17
+
14
18
  def auto_pop!
15
19
  # Because threadpools can be large we want to cap the number
16
20
  # of times we will pop each time we poll the broker
@@ -7,6 +7,12 @@ module ActionSubscriber
7
7
  march_hare_consumers.each(&:cancel)
8
8
  end
9
9
 
10
+ def create_queue(channel, queue_name, queue_options)
11
+ queue = ::MarchHare::Queue.new(channel, queue_name, queue_options)
12
+ queue.declare!
13
+ queue
14
+ end
15
+
10
16
  def auto_pop!
11
17
  # Because threadpools can be large we want to cap the number
12
18
  # of times we will pop each time we poll the broker
@@ -26,8 +26,14 @@ module ActionSubscriber
26
26
 
27
27
  def setup_queue(route)
28
28
  channel = ::ActionSubscriber::RabbitConnection.subscriber_connection.create_channel
29
+ # Make channels threadsafe again! Believe Me!
30
+ # Accessing channels from multiple threads for messsage acknowledgement will crash
31
+ # a channel and stop messages from being received on that channel
32
+ # this isn't very clear in the documentation for march_hare/bunny, but it is
33
+ # explicitly addresses here: https://github.com/rabbitmq/rabbitmq-java-client/issues/53
34
+ channel = ::ActionSubscriber::Synchronizer.new(channel)
29
35
  exchange = channel.topic(route.exchange)
30
- queue = channel.queue(route.queue, :durable => route.durable)
36
+ queue = create_queue(channel, route.queue, :durable => route.durable)
31
37
  queue.bind(exchange, :routing_key => route.routing_key)
32
38
  queue
33
39
  end
@@ -0,0 +1,15 @@
1
+ require "thread"
2
+ module ActionSubscriber
3
+ class Synchronizer
4
+ def initialize(delegate)
5
+ @delegate = delegate
6
+ @mutex = ::Mutex.new
7
+ end
8
+
9
+ def method_missing(name, *args, &block)
10
+ @mutex.synchronize do
11
+ @delegate.public_send(name, *args, &block)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module ActionSubscriber
2
- VERSION = "2.5.0.pre"
2
+ VERSION = "2.5.0.pre2"
3
3
  end
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.5.0.pre
4
+ version: 2.5.0.pre2
5
5
  platform: ruby
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-09-09 00:00:00.000000000 Z
15
+ date: 2016-09-12 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -224,6 +224,7 @@ files:
224
224
  - lib/action_subscriber/router.rb
225
225
  - lib/action_subscriber/rspec.rb
226
226
  - lib/action_subscriber/subscribable.rb
227
+ - lib/action_subscriber/synchronizer.rb
227
228
  - lib/action_subscriber/threadpool.rb
228
229
  - lib/action_subscriber/uri.rb
229
230
  - lib/action_subscriber/version.rb
@@ -277,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
278
  version: 1.3.1
278
279
  requirements: []
279
280
  rubyforge_project:
280
- rubygems_version: 2.5.1
281
+ rubygems_version: 2.6.6
281
282
  signing_key:
282
283
  specification_version: 4
283
284
  summary: ActionSubscriber is a DSL that allows a rails app to consume messages from