eventq_rabbitmq 1.18.2 → 1.19.0
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 +4 -4
- data/lib/eventq_rabbitmq/rabbitmq_eventq_client.rb +16 -3
- data/lib/eventq_rabbitmq/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13cd464a5a739783d0cea336a30c310abd3c7d39
|
4
|
+
data.tar.gz: 5822087a4e16c1ac0624cf98982735157046aade
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
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
|
115
|
+
check_in_connection(connection)
|
103
116
|
end
|
104
117
|
|
105
118
|
true
|