active_publisher 1.1.0 → 1.1.1.pre0

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: 3d2dbcc6e8abb4f3d6cf4540bc2478936e4cb456
4
- data.tar.gz: 4ad3ed20502fc154b3a82498d0a115edcd9125ee
3
+ metadata.gz: 2ee46b505bf480324092c6fbeb6fa7a64516b0f6
4
+ data.tar.gz: ccf8c282de496b001deeb963c28061fe79ae3945
5
5
  SHA512:
6
- metadata.gz: d008144cc34ec4e8a807e98364a6699919f3984d71fb131c837530432328d2e507eb45f2ba76eadf72cbef20ccbe0dc0fd69c2448b2914e6eefabfbd809410f6
7
- data.tar.gz: 73db7866673c54300d0f1aa67a4e603a1176b70fb3ee25a0e6fbc6ee6f4049526b43c20b303a620320cd9de24a802b1000d56f54b53374d3b334807d2697fec1
6
+ metadata.gz: 077f694c76ea2decc70f471b21aec2d236fe485623c30c988bbdce0e4431b7481cbbb77e4cccb3fae7a5f8a60f4240f87af732c0c5815b7ed8291692a65184e1
7
+ data.tar.gz: 8f2655e9855a9bb612f7d92cfc64bee893880f54f2a0025073c751605ac330d5ad3a396b21239e8172d76a70e6513a85c0b1d3f1e5f9eca0937dd69a03ff30b5
@@ -0,0 +1,43 @@
1
+ module ActivePublisher
2
+ module Async
3
+ module InMemoryAdapter
4
+ ##
5
+ # This class is a wrapper around bunny and march hare channels to cache exchanges.
6
+ # Bunny does this by default, but march hare will perform a blocking wait for each
7
+ # exchange declaration.
8
+ #
9
+ class Channel
10
+ attr_reader :rabbit_channel, :topic_exchange_cache
11
+
12
+ def initialize
13
+ @topic_exchange_cache = {}
14
+ @rabbit_channel = ::ActivePublisher::Connection.connection.create_channel
15
+ end
16
+
17
+ def close
18
+ rabbit_channel.close
19
+ end
20
+
21
+ def confirm_select
22
+ rabbit_channel.confirm_select
23
+ end
24
+
25
+ def topic(exchange)
26
+ topic_exchange_cache[exchange] ||= rabbit_channel.topic(exchange)
27
+ end
28
+
29
+ def using_publisher_confirms?
30
+ rabbit_channel.using_publisher_confirms?
31
+ end
32
+
33
+ def wait_for_confirms(timeout)
34
+ if rabbit_channel.method(:wait_for_confirms).arity > 0
35
+ rabbit_channel.wait_for_confirms(timeout)
36
+ else
37
+ rabbit_channel.wait_for_confirms
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -46,7 +46,7 @@ module ActivePublisher
46
46
  end
47
47
 
48
48
  def make_channel
49
- channel = ::ActivePublisher::Connection.connection.create_channel
49
+ channel = ::ActivePublisher::Async::InMemoryAdapter::Channel.new
50
50
  channel.confirm_select if ::ActivePublisher.configuration.publisher_confirms
51
51
  channel
52
52
  end
@@ -122,11 +122,7 @@ module ActivePublisher
122
122
 
123
123
  def wait_for_confirms(channel)
124
124
  return true unless channel.using_publisher_confirms?
125
- if channel.method(:wait_for_confirms).arity > 0
126
- channel.wait_for_confirms(::ActivePublisher.configuration.publisher_confirms_timeout)
127
- else
128
- channel.wait_for_confirms
129
- end
125
+ channel.wait_for_confirms(::ActivePublisher.configuration.publisher_confirms_timeout)
130
126
  end
131
127
  end
132
128
  end
@@ -1,5 +1,6 @@
1
1
  require "active_publisher/message"
2
2
  require "active_publisher/async/in_memory_adapter/async_queue"
3
+ require "active_publisher/async/in_memory_adapter/channel"
3
4
  require "active_publisher/async/in_memory_adapter/consumer_thread"
4
5
  require "concurrent"
5
6
  require "multi_op_queue"
@@ -1,3 +1,3 @@
1
1
  module ActivePublisher
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1.pre0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_publisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1.pre0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Stien
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: exe
14
14
  cert_chain: []
15
- date: 2018-01-08 00:00:00.000000000 Z
15
+ date: 2018-01-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bunny
@@ -152,6 +152,7 @@ files:
152
152
  - lib/active_publisher/async.rb
153
153
  - lib/active_publisher/async/in_memory_adapter.rb
154
154
  - lib/active_publisher/async/in_memory_adapter/async_queue.rb
155
+ - lib/active_publisher/async/in_memory_adapter/channel.rb
155
156
  - lib/active_publisher/async/in_memory_adapter/consumer_thread.rb
156
157
  - lib/active_publisher/configuration.rb
157
158
  - lib/active_publisher/connection.rb
@@ -173,9 +174,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
173
174
  version: '0'
174
175
  required_rubygems_version: !ruby/object:Gem::Requirement
175
176
  requirements:
176
- - - ">="
177
+ - - ">"
177
178
  - !ruby/object:Gem::Version
178
- version: '0'
179
+ version: 1.3.1
179
180
  requirements: []
180
181
  rubyforge_project:
181
182
  rubygems_version: 2.6.13