logstash-integration-rabbitmq 7.3.2-java → 7.3.3-java

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
  SHA256:
3
- metadata.gz: d87b910943f6be19026320fcad93686f4583361f394f4ce5415415bc99faaac3
4
- data.tar.gz: f6dce144b898f2a818f8e9bc0751adc1e467f98ddf002abb6eedbf64f24242bd
3
+ metadata.gz: 78f0b7f1bca3933bd03700f0fbce3865f4b9d53cfb7f17af4c25c28a23000a57
4
+ data.tar.gz: aa2f3ad215acf1ea2f62b5fdfc880d9bcb6b4f0bcd94fe22c3cd214e07353ee7
5
5
  SHA512:
6
- metadata.gz: 2de6023c6ae0ab82548a8933ed89771ebc839a24320e13065e177a12d488f29e329e0ef9983854600c03f28c67f49fcf627ecf92556a8839abbdae9255195d62
7
- data.tar.gz: f0071bfa48a4b2f2c3727bef2543f06c9e88ef92d7a662606f782fccb508028d25f3bd3a7c6107a43334ae86d75ebf0ff6526d27ff400d5035dababf83189977
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
- return unless @consumer
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.2'
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.2
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-05-30 00:00:00.000000000 Z
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