logstash-integration-rabbitmq 7.3.2-java → 7.3.3-java
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/CHANGELOG.md +3 -0
- data/lib/logstash/inputs/rabbitmq.rb +8 -1
- data/logstash-integration-rabbitmq.gemspec +1 -1
- data/spec/inputs/rabbitmq_spec.rb +56 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78f0b7f1bca3933bd03700f0fbce3865f4b9d53cfb7f17af4c25c28a23000a57
|
4
|
+
data.tar.gz: aa2f3ad215acf1ea2f62b5fdfc880d9bcb6b4f0bcd94fe22c3cd214e07353ee7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7650cc2460674b63af00cb41bb6f0460338a9afa76d9df46c4a7e67b7f6e9c128f5a22b6708b66257fce639af2217574ea88d00546d14519260d1fa2f0b52599
|
7
|
+
data.tar.gz: f9843e44ced717e51ea13fad2fab1f321f9ce829b6a4b4886b60e466ca02b4232112d6d3f0531500df402e6e8fa4b36c216b0f3a62fb745f5946223c6f077412
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 7.3.3
|
2
|
+
- Fixed the cancellation flow to avoid multiple invocations of basic.cancel [#55](https://github.com/logstash-plugins/logstash-integration-rabbitmq/pull/55)
|
3
|
+
|
1
4
|
## 7.3.2
|
2
5
|
- Change `tls_certificate_password` type to `password` to protect from leaks in the logs [#54](https://github.com/logstash-plugins/logstash-integration-rabbitmq/pull/54)
|
3
6
|
|
@@ -308,7 +308,14 @@ module LogStash
|
|
308
308
|
end
|
309
309
|
|
310
310
|
def shutdown_consumer
|
311
|
-
|
311
|
+
# There are two possible flows to shutdown consumers. When the plugin is the one shutting down, it should send a channel
|
312
|
+
# cancellation message by invoking channel.basic_cancel(consumer_tag) and waiting for the consumer to terminate
|
313
|
+
# (broker replies with an basic.cancel-ok). This back and forth is handled by MarchHare. On the other hand, when the broker
|
314
|
+
# requests the client to shutdown (eg. due to queue deletion). It sends to the client a basic.cancel message, which is handled
|
315
|
+
# internally by the client, unregistering the consumer and then invoking the :on_cancellation callback. In that case, the plugin
|
316
|
+
# should not do anything as the consumer is already cancelled/unregistered.
|
317
|
+
return if !@consumer || @consumer.cancelled? || @consumer.terminated?
|
318
|
+
|
312
319
|
@hare_info.channel.basic_cancel(@consumer.consumer_tag)
|
313
320
|
connection = @hare_info.connection
|
314
321
|
until @consumer.terminated?
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-integration-rabbitmq'
|
3
|
-
s.version = '7.3.
|
3
|
+
s.version = '7.3.3'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "Integration with RabbitMQ - input and output plugins"
|
6
6
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline "+
|
@@ -63,6 +63,62 @@ describe LogStash::Inputs::RabbitMQ do
|
|
63
63
|
expect(instance.codec.config_name).to eq "json"
|
64
64
|
end
|
65
65
|
|
66
|
+
describe "and #stop is called" do
|
67
|
+
let(:consumer_tag) { "foo-bar-queue" }
|
68
|
+
let(:consumer) { double("consumer") }
|
69
|
+
|
70
|
+
before do
|
71
|
+
instance.register
|
72
|
+
instance.setup!
|
73
|
+
instance.instance_variable_set(:@consumer, consumer)
|
74
|
+
|
75
|
+
allow(instance).to receive(:close_connection)
|
76
|
+
allow(consumer).to receive(:consumer_tag).and_return(consumer_tag)
|
77
|
+
end
|
78
|
+
|
79
|
+
context "with a cancelled consumer" do
|
80
|
+
before do
|
81
|
+
allow(consumer).to receive(:cancelled?).and_return(true)
|
82
|
+
allow(consumer).to receive(:terminated?).and_return(false)
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should not call basic_cancel" do
|
86
|
+
expect(channel).to_not receive(:basic_cancel)
|
87
|
+
instance.stop
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context "with a terminated consumer" do
|
92
|
+
before do
|
93
|
+
allow(consumer).to receive(:cancelled?).and_return(false)
|
94
|
+
allow(consumer).to receive(:terminated?).and_return(true)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should not call basic_cancel" do
|
98
|
+
expect(channel).to_not receive(:basic_cancel)
|
99
|
+
instance.stop
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context "with a running consumer" do
|
104
|
+
before do
|
105
|
+
allow(consumer).to receive(:cancelled?).and_return(false)
|
106
|
+
allow(consumer).to receive(:terminated?).and_return(false, false, true)
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should call basic_cancel" do
|
110
|
+
expect(channel).to receive(:basic_cancel).with(consumer_tag)
|
111
|
+
instance.stop
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should log terminating info" do
|
115
|
+
allow(channel).to receive(:basic_cancel).with(consumer_tag)
|
116
|
+
expect(instance.logger).to receive(:info).with(/Waiting for RabbitMQ consumer to terminate before stopping/, anything)
|
117
|
+
instance.stop
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
66
122
|
describe "#connect!" do
|
67
123
|
subject { hare_info }
|
68
124
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-integration-rabbitmq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.3.
|
4
|
+
version: 7.3.3
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|