eventq_rabbitmq 1.7.8 → 1.7.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0249aa24e7036f041eb1ec1fd8e9fcd1d5a1331d
|
4
|
+
data.tar.gz: b4887ed474c62e87804670ecd428469755bcbf1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fabf20d9fffe7f4e2e474edda40cf610ef823b95dfca966b171883be5f42c980492b38b6a4b60a96821c4e6b3485d62c30d3b00d50ea0b461e294c773fcba32
|
7
|
+
data.tar.gz: 81cd6a969aedd1711d0ed7a677f457138185f5d7d1348d7d14ce006d7f1ac49792732d3acb7f086af9aa69effeece71ab97c16239f5a011a02b48c603cb9e02c
|
@@ -17,6 +17,8 @@ module EventQ
|
|
17
17
|
def raise_event(event_type, event)
|
18
18
|
|
19
19
|
connection = @client.get_connection
|
20
|
+
|
21
|
+
begin
|
20
22
|
channel = connection.create_channel
|
21
23
|
|
22
24
|
ex = @queue_manager.get_exchange(channel, @event_raised_exchange)
|
@@ -30,6 +32,13 @@ module EventQ
|
|
30
32
|
message = serialization_provider.serialize(qm)
|
31
33
|
|
32
34
|
ex.publish(message, :routing_key => event_type)
|
35
|
+
rescue => e
|
36
|
+
|
37
|
+
channel.close
|
38
|
+
connection.close
|
39
|
+
raise e
|
40
|
+
end
|
41
|
+
|
33
42
|
channel.close
|
34
43
|
connection.close
|
35
44
|
|
@@ -67,7 +67,7 @@ module EventQ
|
|
67
67
|
manager = EventQ::RabbitMq::QueueManager.new
|
68
68
|
manager.durable = options[:durable]
|
69
69
|
|
70
|
-
connection = client.get_connection
|
70
|
+
@connection = client.get_connection
|
71
71
|
|
72
72
|
@threads = []
|
73
73
|
|
@@ -85,7 +85,7 @@ module EventQ
|
|
85
85
|
|
86
86
|
begin
|
87
87
|
|
88
|
-
channel = connection.create_channel
|
88
|
+
channel = @connection.create_channel
|
89
89
|
|
90
90
|
thread_process_iteration(channel, manager, queue, block)
|
91
91
|
|
@@ -106,7 +106,7 @@ module EventQ
|
|
106
106
|
|
107
107
|
if options.key?(:wait) && options[:wait] == true
|
108
108
|
@threads.each { |thr| thr.join }
|
109
|
-
connection.close
|
109
|
+
@connection.close
|
110
110
|
end
|
111
111
|
|
112
112
|
return true
|
@@ -180,7 +180,7 @@ module EventQ
|
|
180
180
|
puts "[#{self.class}] - Stopping..."
|
181
181
|
@is_running = false
|
182
182
|
@threads.each { |thr| thr.join }
|
183
|
-
|
183
|
+
@connection.close
|
184
184
|
return true
|
185
185
|
end
|
186
186
|
|
@@ -15,6 +15,7 @@ module EventQ
|
|
15
15
|
|
16
16
|
connection = @client.get_connection
|
17
17
|
channel = connection.create_channel
|
18
|
+
|
18
19
|
queue = @queue_manager.get_queue(channel, queue)
|
19
20
|
exchange = @queue_manager.get_exchange(channel, @event_raised_exchange)
|
20
21
|
|
@@ -28,13 +29,17 @@ module EventQ
|
|
28
29
|
|
29
30
|
def unsubscribe(queue)
|
30
31
|
|
31
|
-
|
32
|
+
connection = @client.get_connection
|
33
|
+
channel = connection.create_channel
|
32
34
|
|
33
35
|
queue = @queue_manager.get_queue(channel, queue)
|
34
36
|
exchange = @queue_manager.get_exchange(channel, @event_raised_exchange)
|
35
37
|
|
36
38
|
queue.unbind(exchange)
|
37
39
|
|
40
|
+
channel.close
|
41
|
+
connection.close
|
42
|
+
|
38
43
|
return true
|
39
44
|
end
|
40
45
|
|