logstash-integration-rabbitmq 7.3.1-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be6173ecd7fbbddb8e1141299c6b356c433d9ab4bf39d7648263a3dabdd008ec
4
- data.tar.gz: 36bed2271d02ffb63c9b38376fbb557611c9c404718fd079746de01884045b0f
3
+ metadata.gz: 78f0b7f1bca3933bd03700f0fbce3865f4b9d53cfb7f17af4c25c28a23000a57
4
+ data.tar.gz: aa2f3ad215acf1ea2f62b5fdfc880d9bcb6b4f0bcd94fe22c3cd214e07353ee7
5
5
  SHA512:
6
- metadata.gz: 34d6f70ada083a69851f4ca408b27be8621510636f4431318e9878ef8a149ebd145ebec01a3dfe6b069bf087574d82ec5f9370732a3de096834657dbeb8c1c10
7
- data.tar.gz: 0bcdf91950807897ab670b1a5fb6ffaecd1c14f4bb26278ba7e580ebb3fd2fb1a7daf9b90ba7bd5fe77cdab450514d16071db17dfbdc775279e0ec6058116d9b
6
+ metadata.gz: 7650cc2460674b63af00cb41bb6f0460338a9afa76d9df46c4a7e67b7f6e9c128f5a22b6708b66257fce639af2217574ea88d00546d14519260d1fa2f0b52599
7
+ data.tar.gz: f9843e44ced717e51ea13fad2fab1f321f9ce829b6a4b4886b60e466ca02b4232112d6d3f0531500df402e6e8fa4b36c216b0f3a62fb745f5946223c6f077412
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
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
+
4
+ ## 7.3.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)
6
+
1
7
  ## 7.3.1
2
8
  - DOCS: clarify the availability and cost of using the `metadata_enabled` option [#52](https://github.com/logstash-plugins/logstash-integration-rabbitmq/pull/52)
3
9
 
@@ -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?
@@ -81,12 +81,6 @@ module LogStash
81
81
  # Passive queue creation? Useful for checking queue existance without modifying server state
82
82
  config :passive, :validate => :boolean, :default => false
83
83
 
84
- # TLS certifcate path
85
- config :tls_certificate_path, :validate => :path, :obsolete => "This setting is obsolete. Use ssl_certificate_path instead"
86
-
87
- # TLS certificate password
88
- config :tls_certificate_password, :validate => :string, :obsolete => "This setting is obsolete. Use ssl_certificate_password instead"
89
-
90
84
  # Extra queue arguments as an array.
91
85
  # To make a RabbitMQ queue mirrored, use: `{"x-ha-policy" => "all"}`
92
86
  config :arguments, :validate => :array, :default => {}
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-integration-rabbitmq'
3
- s.version = '7.3.1'
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.1
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: 2022-10-04 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
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  - !ruby/object:Gem::Version
218
218
  version: '0'
219
219
  requirements: []
220
- rubygems_version: 3.1.6
220
+ rubygems_version: 3.2.33
221
221
  signing_key:
222
222
  specification_version: 4
223
223
  summary: Integration with RabbitMQ - input and output plugins