rabbitmq-receiver 1.1.0 → 1.2.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60a84ed4f3ea345eaf53f0c6f780a53c2583055b
|
4
|
+
data.tar.gz: c6fbbaf8ff7150c0e14a2834d32f305323e22dc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dabd0efe4678dae7dd0dd0927713fffcceae936f9af2c89314789ae271a5324f5b21a9051d2189bf3e9ee58a4dcec2f086dab81cdb7f101456d861cf469f79ff
|
7
|
+
data.tar.gz: 6b6b54e9d4dca75240fac684ba3d6f628454fe6a6235cdb43b8a8d1f581f306b68b488922f08b11a38a0de24bf7e36d47ffdf43c0f276c519b6cdf7691419daa
|
@@ -10,17 +10,18 @@ require 'gconfig'
|
|
10
10
|
module Rabbitmq
|
11
11
|
class Receiver
|
12
12
|
extend GConfig
|
13
|
-
|
14
|
-
default
|
15
|
-
default
|
16
|
-
default
|
17
|
-
default
|
18
|
-
default
|
19
|
-
default
|
20
|
-
default
|
21
|
-
default
|
22
|
-
default
|
23
|
-
default
|
24
|
-
default heartbeat:
|
13
|
+
default logger: Logger.new(STDOUT)
|
14
|
+
default host: '8.8.8.8'
|
15
|
+
default port: 5672
|
16
|
+
default user: nil
|
17
|
+
default password: nil
|
18
|
+
default queue: nil
|
19
|
+
default vhost: '/'
|
20
|
+
default verbose: false
|
21
|
+
default prefetch: 100
|
22
|
+
default durable: true
|
23
|
+
default exclusive: false
|
24
|
+
default heartbeat: 5
|
25
|
+
default auto_delete: false
|
25
26
|
end
|
26
27
|
end
|
@@ -52,7 +52,7 @@ module Rabbitmq
|
|
52
52
|
|
53
53
|
@rmq_channel = @rmq_connection.create_channel
|
54
54
|
@rmq_channel.prefetch(@options[:prefetch])
|
55
|
-
@rmq_queue = @rmq_channel.queue(@options[:queue], durable:
|
55
|
+
@rmq_queue = @rmq_channel.queue(@options[:queue], durable: @options[:durable], auto_delete: @options[:auto_delete], exlusive: @options[:exclusive])
|
56
56
|
rescue Exception => error
|
57
57
|
@options[:logger].error "Error: #{error.message}".red
|
58
58
|
sleep(sleep_duration)
|
@@ -82,6 +82,7 @@ module Rabbitmq
|
|
82
82
|
raise error if error.class == Bunny::ChannelAlreadyClosed
|
83
83
|
rescue LocalJumpError
|
84
84
|
Rabbitmq::Receiver.instance.running = false
|
85
|
+
@rmq_channel.ack(delivery_info.delivery_tag)
|
85
86
|
@rmq_channel.consumers[delivery_info.consumer_tag].cancel
|
86
87
|
rescue Exception => error
|
87
88
|
@options[:logger].error "Error: #{error.class} #{error.message}"
|
@@ -27,6 +27,7 @@ module Rabbitmq
|
|
27
27
|
end
|
28
28
|
sleep sleep_duration
|
29
29
|
end
|
30
|
+
@running = true
|
30
31
|
end
|
31
32
|
|
32
33
|
def start(options = {}, &block)
|
@@ -34,7 +35,7 @@ module Rabbitmq
|
|
34
35
|
@running = false
|
35
36
|
@action = block
|
36
37
|
|
37
|
-
@options[:logger].info "------- Runner on #{@options[:host]} starting.".white
|
38
|
+
@options[:logger].info "------- Runner on #{@options[:host]} starting.".white if @options[:verbose]
|
38
39
|
|
39
40
|
self.run
|
40
41
|
end
|