eventq_rabbitmq 1.18.2 → 1.19.0

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: 5381524d2211718bb7546c75d018738226b0a804
4
- data.tar.gz: 6782a6cb75252c6de9bb02e613a17dd3867a1945
3
+ metadata.gz: 13cd464a5a739783d0cea336a30c310abd3c7d39
4
+ data.tar.gz: 5822087a4e16c1ac0624cf98982735157046aade
5
5
  SHA512:
6
- metadata.gz: cfa083370ac51d6599934499b3a28305e1013dc67f648e0a80cd9b07a2b64d734f75fcd19f48de0409d99cb6baebf421390738785da50035e879bab214ae23fd
7
- data.tar.gz: 6213f9ddf00982279deeedb301fc9e47ace511e224b8d4012327da0f537f7f5780a9fc0bee9b15def5c464aa355917878e4b3a2b53b7ecaa07ced3d795b56ed1
6
+ metadata.gz: 4f13df12855a0d083953b2aeba753f2ee8820bde6c5ff8e5156bc63b5fde1fe202f420a55980c29c47874a4e2c558b928611e8332e21763920955373153d5d18
7
+ data.tar.gz: 2f0b6210accda7fad22e3aab6a1173b6971df00474b9a15f968f80ca02e5b8d91e1149d919791af2013645efc6ee49468d0c91ce0f76a339d50c918f297177ca
@@ -1,3 +1,4 @@
1
+ require 'thread'
1
2
  module EventQ
2
3
  module RabbitMq
3
4
  # Implements a general interface to raise an event
@@ -16,8 +17,20 @@ module EventQ
16
17
  @serialization_manager = EventQ::SerializationProviders::Manager.new
17
18
  @signature_manager = EventQ::SignatureProviders::Manager.new
18
19
 
19
- #this array is used to record known event types
20
+ # this array is used to record known event types
20
21
  @known_event_types = []
22
+
23
+ @connection_pool = ::Queue.new
24
+ end
25
+
26
+ def check_out_connection
27
+ @connection_pool.pop(true)
28
+ rescue
29
+ @client.get_connection
30
+ end
31
+
32
+ def check_in_connection(connection)
33
+ @connection_pool.push(connection)
21
34
  end
22
35
 
23
36
  def registered?(event_type)
@@ -90,7 +103,7 @@ module EventQ
90
103
  private
91
104
 
92
105
  def with_connection
93
- connection = @client.get_connection
106
+ connection = check_out_connection
94
107
 
95
108
  begin
96
109
  channel = connection.create_channel
@@ -99,7 +112,7 @@ module EventQ
99
112
 
100
113
  ensure
101
114
  channel&.close if channel.open?
102
- connection.close
115
+ check_in_connection(connection)
103
116
  end
104
117
 
105
118
  true
@@ -1,3 +1,3 @@
1
1
  module EventqRabbitmq
2
- VERSION = "1.18.2"
2
+ VERSION = "1.19.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventq_rabbitmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.2
4
+ version: 1.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughanbrittonsage