logstash-input-jms 3.1.0-java → 3.2.1-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 +17 -1
- data/README.md +1 -1
- data/docs/index.asciidoc +143 -15
- data/lib/logstash/inputs/jms.rb +219 -28
- data/logstash-input-jms.gemspec +8 -5
- data/spec/inputs/integration/jms_spec.rb +153 -63
- data/spec/inputs/spec_helper.rb +37 -1
- data/spec/inputs/unit/jms_spec.rb +66 -10
- metadata +50 -9
@@ -1,11 +1,8 @@
|
|
1
1
|
require_relative '../spec_helper'
|
2
2
|
require 'logstash/inputs/jms'
|
3
|
-
require '
|
4
|
-
require 'json'
|
3
|
+
require 'logstash/plugin_mixins/ecs_compatibility_support/spec_helper'
|
5
4
|
require 'securerandom'
|
6
5
|
|
7
|
-
|
8
|
-
|
9
6
|
shared_examples_for "a JMS input" do
|
10
7
|
context 'when inputting messages' do
|
11
8
|
let (:destination) { "#{pub_sub ? 'topic' : 'queue'}://#{queue_name}"}
|
@@ -15,7 +12,7 @@ shared_examples_for "a JMS input" do
|
|
15
12
|
let(:message) { "Hello There" }
|
16
13
|
|
17
14
|
context 'when properties are skipped' do
|
18
|
-
let (:
|
15
|
+
let (:config) { super().merge({'skip_properties' => ['this', 'that']})}
|
19
16
|
|
20
17
|
it 'should skip the specified property and process other properties, headers and the message' do
|
21
18
|
send_message do |session|
|
@@ -25,17 +22,17 @@ shared_examples_for "a JMS input" do
|
|
25
22
|
msg.set_string_property('the_other', 'the_other_prop')
|
26
23
|
msg
|
27
24
|
end
|
28
|
-
expect(queue.first.get('message')).to eql
|
29
|
-
expect(queue.first.
|
30
|
-
expect(queue.first.
|
31
|
-
expect(queue.first.
|
32
|
-
expect(queue.first.
|
33
|
-
expect(queue.first.
|
25
|
+
expect(queue.first.get('message')).to eql(message)
|
26
|
+
expect(queue.first).to have_header('jms_destination')
|
27
|
+
expect(queue.first).to have_header('jms_timestamp')
|
28
|
+
expect(queue.first).not_to have_property('this')
|
29
|
+
expect(queue.first).not_to have_property('this')
|
30
|
+
expect(queue.first).to have_property_value('the_other', 'the_other_prop')
|
34
31
|
end
|
35
32
|
end
|
36
33
|
|
37
34
|
context 'when using message selectors' do
|
38
|
-
let (:
|
35
|
+
let (:config) { super().merge({'selector' => selector }) }
|
39
36
|
|
40
37
|
context 'with multiple selector query parameter' do
|
41
38
|
let (:selector) { "this = 3 OR this = 4" }
|
@@ -47,9 +44,9 @@ shared_examples_for "a JMS input" do
|
|
47
44
|
msg.set_int_property('this', 4)
|
48
45
|
msg
|
49
46
|
end
|
50
|
-
expect(queue.first.get('message')).to eql
|
51
|
-
expect(queue.first.
|
52
|
-
expect(queue.first.
|
47
|
+
expect(queue.first.get('message')).to eql(message)
|
48
|
+
expect(queue.first).to have_property_value('this', 4)
|
49
|
+
expect(queue.first).to have_property_value('that', 'that_prop')
|
53
50
|
end
|
54
51
|
|
55
52
|
it 'does not process messages that do not conform to the message selector' do
|
@@ -73,9 +70,9 @@ shared_examples_for "a JMS input" do
|
|
73
70
|
msg.set_int_property('this', 3)
|
74
71
|
msg
|
75
72
|
end
|
76
|
-
expect(queue.first.get('message')).to eql
|
77
|
-
expect(queue.first.
|
78
|
-
expect(queue.first.
|
73
|
+
expect(queue.first.get('message')).to eql(message)
|
74
|
+
expect(queue.first).to have_property_value('this', 3)
|
75
|
+
expect(queue.first).to have_property_value('that', 'that_prop')
|
79
76
|
end
|
80
77
|
|
81
78
|
it 'does not process messages that do not conform to the message selector' do
|
@@ -100,8 +97,8 @@ shared_examples_for "a JMS input" do
|
|
100
97
|
msg
|
101
98
|
end
|
102
99
|
expect(queue.first.get('message')).to eql(message)
|
103
|
-
expect(queue.first
|
104
|
-
expect(queue.first.
|
100
|
+
expect(get_property_value(queue.first, 'this')).to be_within(0.001).of(3.1)
|
101
|
+
expect(queue.first).to have_property_value('that', 'that_prop')
|
105
102
|
end
|
106
103
|
|
107
104
|
it 'does not process messages that do not conform to the message selector' do
|
@@ -126,9 +123,9 @@ shared_examples_for "a JMS input" do
|
|
126
123
|
msg.set_string_property('that', 'that_prop')
|
127
124
|
msg
|
128
125
|
end
|
129
|
-
expect(queue.first.get('message')).to eql
|
130
|
-
expect(queue.first.
|
131
|
-
expect(queue.first.
|
126
|
+
expect(queue.first.get('message')).to eql(message)
|
127
|
+
expect(queue.first).to have_property_value('this', 'this_prop')
|
128
|
+
expect(queue.first).to have_property_value('that', 'that_prop')
|
132
129
|
end
|
133
130
|
|
134
131
|
it 'does not process messages that do not conform to the message selector' do
|
@@ -145,7 +142,8 @@ shared_examples_for "a JMS input" do
|
|
145
142
|
end
|
146
143
|
|
147
144
|
context 'when headers are skipped' do
|
148
|
-
let (:
|
145
|
+
let (:config) { super().merge('skip_headers' => ['jms_destination', 'jms_reply_to']) }
|
146
|
+
|
149
147
|
it 'should skip the specified header and process other headers, properties and the message' do
|
150
148
|
send_message do |session|
|
151
149
|
msg = session.message(message)
|
@@ -155,42 +153,133 @@ shared_examples_for "a JMS input" do
|
|
155
153
|
msg.set_string_property('the_other', 'the_other_prop')
|
156
154
|
msg
|
157
155
|
end
|
158
|
-
expect(queue.first.get('message')).to eql
|
159
|
-
expect(queue.first.
|
160
|
-
expect(queue.first.
|
161
|
-
expect(queue.first.
|
162
|
-
expect(queue.first.
|
163
|
-
expect(queue.first.
|
156
|
+
expect(queue.first.get('message')).to eql(message)
|
157
|
+
expect(queue.first).not_to have_header('jms_destination')
|
158
|
+
expect(queue.first).to have_header('jms_timestamp')
|
159
|
+
expect(queue.first).to have_property_value('this', 'this_prop')
|
160
|
+
expect(queue.first).to have_property_value('that', 'that_prop')
|
161
|
+
expect(queue.first).to have_property_value('the_other', 'the_other_prop')
|
164
162
|
end
|
165
163
|
end
|
166
164
|
|
167
|
-
context 'when
|
168
|
-
|
165
|
+
context 'when include_headers => false' do
|
166
|
+
let (:config) { super().merge('include_headers' => 'false') }
|
167
|
+
|
168
|
+
it 'should skip all headers' do
|
169
169
|
send_message do |session|
|
170
170
|
msg = session.message(message)
|
171
|
-
msg.
|
172
|
-
msg.set_string_property('
|
173
|
-
msg
|
171
|
+
msg.reply_to = session.create_destination(:topic_name => SecureRandom.hex(8))
|
172
|
+
msg.set_string_property('some', 'property')
|
173
|
+
msg
|
174
|
+
end
|
175
|
+
event = queue.first.to_hash_with_metadata
|
176
|
+
expect( event.keys.find { |name| name.start_with?('jms_') } ).to be nil
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
context 'when include_header => false (deprecated)' do
|
181
|
+
let (:config) { super().merge('include_header' => 'false') }
|
182
|
+
|
183
|
+
it 'should skip all headers' do
|
184
|
+
send_message do |session|
|
185
|
+
msg = session.message(message)
|
186
|
+
msg.reply_to = session.create_destination(:topic_name => SecureRandom.hex(8))
|
187
|
+
msg.set_string_property('some', 'property')
|
174
188
|
msg
|
175
189
|
end
|
176
|
-
|
177
|
-
expect(
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
190
|
+
event = queue.first.to_hash_with_metadata
|
191
|
+
expect( event.keys.find { |name| name.start_with?('jms_') } ).to be nil
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
context 'when neither header nor property is skipped', :ecs_compatibility_support do
|
196
|
+
ecs_compatibility_matrix(:disabled, :v1, :v8) do |ecs_select|
|
197
|
+
|
198
|
+
let(:ecs_compatibility?) { ecs_select.active_mode != :disabled }
|
199
|
+
|
200
|
+
let (:config) { super().merge('ecs_compatibility' => ecs_select.active_mode) }
|
201
|
+
|
202
|
+
it 'should process properties, headers and the message' do
|
203
|
+
send_message do |session|
|
204
|
+
msg = session.message(message)
|
205
|
+
msg.set_string_property('this', 'this_prop')
|
206
|
+
msg.set_int_property('camelCase', 42)
|
207
|
+
msg.set_boolean_property('JMSFlag', true)
|
208
|
+
msg
|
209
|
+
end
|
210
|
+
|
211
|
+
event = queue.first
|
212
|
+
|
213
|
+
expect(event.get('message')).to eql(message)
|
214
|
+
|
215
|
+
# headers
|
216
|
+
if ecs_compatibility?
|
217
|
+
expect(event.include?('jms_timestamp')).to be false
|
218
|
+
expect(event.include?('jms_destination')).to be false
|
219
|
+
expect(event.get('[@metadata][input][jms][headers][jms_timestamp]')).to be_a Integer
|
220
|
+
expect(event.get('[@metadata][input][jms][headers][jms_destination]')).to_not be nil
|
221
|
+
expect(event.include?("[@metadata][input][jms][headers][jms_delivery_mode_sym]")).to be false
|
222
|
+
expect(event.include?("[@metadata][input][jms][headers][jms_delivery_mode]")).to be true
|
223
|
+
else
|
224
|
+
expect(event.get('jms_timestamp')).to be_a Integer
|
225
|
+
expect(event.get('jms_destination')).to_not be nil
|
226
|
+
expect(event.include?("jms_delivery_mode_sym")).to be true
|
227
|
+
end
|
228
|
+
|
229
|
+
# properties
|
230
|
+
if ecs_compatibility?
|
231
|
+
expect(event.include?('this')).to be false
|
232
|
+
expect(event.get('[@metadata][input][jms][properties][this]')).to eq 'this_prop'
|
233
|
+
expect(event.get('[@metadata][input][jms][properties][camelCase]')).to eq 42
|
234
|
+
expect(event.get('[@metadata][input][jms][properties][JMSFlag]')).to be true
|
235
|
+
else
|
236
|
+
expect(event.get('this')).to eq 'this_prop'
|
237
|
+
expect(event.get('camelCase')).to eq 42
|
238
|
+
expect(event.get('JMSFlag')).to be true
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
182
242
|
end
|
183
243
|
end
|
184
244
|
end
|
185
245
|
|
186
|
-
context 'when the message is map message' do
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
246
|
+
context 'when the message is map message', :ecs_compatibility_support do
|
247
|
+
|
248
|
+
ecs_compatibility_matrix(:disabled, :v1, :v8) do |ecs_select|
|
249
|
+
|
250
|
+
let(:ecs_compatibility?) { ecs_select.active_mode != :disabled }
|
251
|
+
|
252
|
+
let (:config) { super().merge('ecs_compatibility' => ecs_select.active_mode) }
|
253
|
+
|
254
|
+
let(:message) { {:one => 1} }
|
255
|
+
|
256
|
+
before do
|
257
|
+
if ecs_compatibility?
|
258
|
+
expect(subject.logger).to receive(:info).once.with /ECS compatibility is enabled but `target` option was not specified/i
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
it 'should read the message' do
|
263
|
+
send_message
|
264
|
+
|
265
|
+
expect(queue.size).to eql 1
|
266
|
+
event = queue.first
|
267
|
+
expect(event.get('one')).to eql 1
|
268
|
+
|
269
|
+
if ecs_compatibility?
|
270
|
+
expect(event.get('[@metadata][input][jms][headers][jms_destination]')).to eql(destination)
|
271
|
+
expect(event.get('[@metadata][input][jms][headers][jms_delivery_mode]')).to eql 'persistent'
|
272
|
+
expect(event.include?('[@metadata][input][jms][headers][jms_delivery_mode_sym]')).to be false
|
273
|
+
else
|
274
|
+
expect(event.get("jms_destination")).to eql(destination)
|
275
|
+
expect(event.get("jms_delivery_mode_sym")).to eql :persistent
|
276
|
+
end
|
277
|
+
|
278
|
+
send_message # should not log the ECS warning again
|
279
|
+
end
|
280
|
+
|
193
281
|
end
|
282
|
+
|
194
283
|
end
|
195
284
|
|
196
285
|
context 'when the message is a bytes message' do
|
@@ -203,17 +292,26 @@ shared_examples_for "a JMS input" do
|
|
203
292
|
jms_message
|
204
293
|
end
|
205
294
|
expect(queue.size).to eql 1
|
206
|
-
expect(queue.first.get('message')).to eql
|
207
|
-
expect(queue.first.
|
295
|
+
expect(queue.first.get('message')).to eql 'hello world'
|
296
|
+
expect(queue.first).to have_header_value("jms_destination", destination)
|
208
297
|
end
|
209
298
|
end
|
210
299
|
end
|
211
300
|
end
|
212
301
|
|
213
|
-
describe
|
302
|
+
describe LogStash::Inputs::Jms, :integration => true do
|
214
303
|
let (:message) { "hello World" }
|
215
304
|
let (:queue_name) { SecureRandom.hex(8)}
|
216
305
|
|
306
|
+
let (:yaml_section) { 'activemq' }
|
307
|
+
let (:config) {{'yaml_file' => fixture_path("jms.yml"),
|
308
|
+
'yaml_section' => yaml_section,
|
309
|
+
'destination' => queue_name,
|
310
|
+
'pub_sub' => pub_sub,
|
311
|
+
'interval' => 2}}
|
312
|
+
|
313
|
+
subject(:input) { described_class.new(config) }
|
314
|
+
|
217
315
|
before :each do
|
218
316
|
allow(input).to receive(:jms_config_from_yaml) do |yaml_file, section|
|
219
317
|
settings = YAML.load_file(yaml_file)[section]
|
@@ -222,14 +320,6 @@ describe "input/jms", :integration => true do
|
|
222
320
|
end
|
223
321
|
end
|
224
322
|
|
225
|
-
let (:yaml_section) { 'activemq' }
|
226
|
-
let (:jms_config) {{'yaml_file' => fixture_path("jms.yml"),
|
227
|
-
'yaml_section' => yaml_section,
|
228
|
-
'destination' => queue_name,
|
229
|
-
'pub_sub' => pub_sub,
|
230
|
-
'interval' => 2}}
|
231
|
-
let(:input) { LogStash::Plugin.lookup("input", "jms").new(jms_config) }
|
232
|
-
|
233
323
|
after :each do
|
234
324
|
input.close unless input.nil?
|
235
325
|
end
|
@@ -241,7 +331,7 @@ describe "input/jms", :integration => true do
|
|
241
331
|
end
|
242
332
|
|
243
333
|
context 'with pub_sub true and durable subscriber' do
|
244
|
-
let (:
|
334
|
+
let (:config) { super().merge({'durable_subscriber' => true,
|
245
335
|
'durable_subscriber_client_id' => SecureRandom.hex(8),
|
246
336
|
'durable_subscriber_name' => SecureRandom.hex(8) } ) }
|
247
337
|
|
@@ -258,8 +348,8 @@ describe "input/jms", :integration => true do
|
|
258
348
|
|
259
349
|
context 'with tls', :tls => true do
|
260
350
|
let (:yaml_section) { 'activemq_tls' }
|
261
|
-
let (:
|
262
|
-
|
351
|
+
let (:config) { super().merge({"keystore" => fixture_path("keystore.jks"), "keystore_password" => "changeit",
|
352
|
+
"truststore" => fixture_path("keystore.jks"), "truststore_password" => "changeit"})}
|
263
353
|
|
264
354
|
context 'with pub_sub true' do
|
265
355
|
let (:pub_sub) { true }
|
@@ -267,7 +357,7 @@ describe "input/jms", :integration => true do
|
|
267
357
|
end
|
268
358
|
|
269
359
|
context 'with pub_sub true and durable subscriber' do
|
270
|
-
let (:
|
360
|
+
let (:config) { super().merge({'durable_subscriber' => true,
|
271
361
|
'durable_subscriber_client_id' => SecureRandom.hex(8),
|
272
362
|
'durable_subscriber_name' => SecureRandom.hex(8) } ) }
|
273
363
|
|
data/spec/inputs/spec_helper.rb
CHANGED
@@ -32,6 +32,42 @@ def send_message(&block)
|
|
32
32
|
end
|
33
33
|
input.run(queue)
|
34
34
|
|
35
|
-
destination = "#{pub_sub ? 'topic' : 'queue'}://#{queue_name}"
|
36
35
|
tt.join(3)
|
37
36
|
end
|
37
|
+
|
38
|
+
|
39
|
+
def get_value(type, actual, name)
|
40
|
+
actual.get(name) || actual.get("[@metadata][input][jms][#{type}][#{name}]")
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_header_value(actual, name)
|
44
|
+
get_value('headers', actual, name)
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_property_value(actual, name)
|
48
|
+
get_value('properties', actual, name)
|
49
|
+
end
|
50
|
+
|
51
|
+
RSpec::Matchers.define :have_header do |expected|
|
52
|
+
match do |actual|
|
53
|
+
get_header_value(actual, expected)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
RSpec::Matchers.define :have_property do |expected|
|
58
|
+
match do |actual|
|
59
|
+
get_property_value(actual, expected)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
RSpec::Matchers.define :have_header_value do |header, expected|
|
64
|
+
match do |actual|
|
65
|
+
expected == get_header_value(actual, header)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
RSpec::Matchers.define :have_property_value do |property, expected|
|
70
|
+
match do |actual|
|
71
|
+
expected == get_property_value(actual, property)
|
72
|
+
end
|
73
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require_relative '../spec_helper'
|
2
2
|
require 'logstash/inputs/jms'
|
3
|
-
require '
|
4
|
-
require '
|
3
|
+
require 'logstash/plugin_mixins/ecs_compatibility_support/spec_helper'
|
4
|
+
require 'securerandom'
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe LogStash::Inputs::Jms do
|
7
7
|
let (:queue_name) {SecureRandom.hex(8)}
|
8
8
|
let (:jms_config) {{'destination' => queue_name}}
|
9
9
|
|
@@ -37,10 +37,10 @@ describe "inputs/jms" do
|
|
37
37
|
context 'configuration check' do
|
38
38
|
context 'if threads is > 1' do
|
39
39
|
let(:thread_count) { 2 }
|
40
|
-
let(:jms_config) { super.merge({'threads' => thread_count})}
|
40
|
+
let(:jms_config) { super().merge({'threads' => thread_count})}
|
41
41
|
|
42
42
|
context 'with pub_sub set to true' do
|
43
|
-
let(:jms_config) { super.merge({'pub_sub' => true})}
|
43
|
+
let(:jms_config) { super().merge({'pub_sub' => true})}
|
44
44
|
|
45
45
|
it 'should raise a configuration error' do
|
46
46
|
expect { plugin.register }.to raise_error(LogStash::ConfigurationError)
|
@@ -48,7 +48,7 @@ describe "inputs/jms" do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
context 'with pub_sub set to false' do
|
51
|
-
let(:jms_config) { super.merge({'pub_sub' => false})}
|
51
|
+
let(:jms_config) { super().merge({'pub_sub' => false})}
|
52
52
|
|
53
53
|
it 'should not raise a configuration error' do
|
54
54
|
plugin.register
|
@@ -58,13 +58,13 @@ describe "inputs/jms" do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
context 'with durable_subscriber set' do
|
61
|
-
let(:jms_config) { super.merge({ 'pub_sub' => true,
|
61
|
+
let(:jms_config) { super().merge({ 'pub_sub' => true,
|
62
62
|
'durable_subscriber' => true,
|
63
63
|
'durable_subscriber_name' => SecureRandom.hex(8),
|
64
64
|
'durable_subscriber_client_id' => SecureRandom.hex(8)})}
|
65
65
|
|
66
66
|
context 'if durable_subscriber_client_id is not set' do
|
67
|
-
let(:jms_config) { super.tap { |h| h.delete('durable_subscriber_client_id') } }
|
67
|
+
let(:jms_config) { super().tap { |h| h.delete('durable_subscriber_client_id') } }
|
68
68
|
|
69
69
|
it 'should set client_id to Logstash' do
|
70
70
|
plugin.register
|
@@ -73,7 +73,7 @@ describe "inputs/jms" do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
context 'if durable_subscriber_name is not set' do
|
76
|
-
let(:jms_config) { super.tap { |h| h.delete('durable_subscriber_name') } }
|
76
|
+
let(:jms_config) { super().tap { |h| h.delete('durable_subscriber_name') } }
|
77
77
|
|
78
78
|
it 'should set name to the topic name' do
|
79
79
|
plugin.register
|
@@ -83,7 +83,7 @@ describe "inputs/jms" do
|
|
83
83
|
|
84
84
|
|
85
85
|
context 'if pub_sub is set to false' do
|
86
|
-
let(:jms_config) { super.merge({'pub_sub' => false})}
|
86
|
+
let(:jms_config) { super().merge({'pub_sub' => false})}
|
87
87
|
it 'should raise a configuration error' do
|
88
88
|
expect { plugin.register }.to raise_error(LogStash::ConfigurationError)
|
89
89
|
end
|
@@ -253,4 +253,60 @@ describe "inputs/jms" do
|
|
253
253
|
end
|
254
254
|
end
|
255
255
|
end
|
256
|
+
|
257
|
+
context 'invalid configuration' do
|
258
|
+
let (:jms_config) { super().merge('include_headers' => true, 'include_header' => false) }
|
259
|
+
|
260
|
+
it 'should raise a configuration error' do
|
261
|
+
expect { subject.register }.to raise_error LogStash::ConfigurationError,
|
262
|
+
/Both `include_headers => true` and `include_header => false` options are specified/i
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
context 'targets', :ecs_compatibility_support do
|
267
|
+
|
268
|
+
ecs_compatibility_matrix(:disabled, :v1, :v8) do |ecs_select|
|
269
|
+
|
270
|
+
let (:jms_config) do
|
271
|
+
super().merge(
|
272
|
+
'include_body' => false,
|
273
|
+
'include_headers' => true, 'headers_target' => '@metadata',
|
274
|
+
'include_properties' => true, 'properties_target' => '[@metadata]'
|
275
|
+
)
|
276
|
+
end
|
277
|
+
|
278
|
+
let(:jms_timestamp) { 1 }
|
279
|
+
|
280
|
+
let(:jms_message_double) do
|
281
|
+
message = double('jms-message-stub')
|
282
|
+
allow(message).to receive(:jms_timestamp).and_return(jms_timestamp)
|
283
|
+
allow_any_instance_of(described_class).to receive(:map_headers).and_return(
|
284
|
+
'jms_message_id' => 'id1', 'jms_timestamp' => jms_timestamp, 'jms_expiration' => nil
|
285
|
+
)
|
286
|
+
allow(message).to receive(:properties).and_return(:foo => 'bar', 'the-baz' => 42)
|
287
|
+
message
|
288
|
+
end
|
289
|
+
|
290
|
+
before(:each) do
|
291
|
+
allow_any_instance_of(described_class).to receive(:ecs_compatibility).and_return(ecs_compatibility)
|
292
|
+
|
293
|
+
plugin.register
|
294
|
+
plugin.queue_event(jms_message_double, queue = [])
|
295
|
+
expect(queue.size).to eql 1
|
296
|
+
@event = queue.first
|
297
|
+
end
|
298
|
+
|
299
|
+
it 'sets headers into meta-data' do
|
300
|
+
expect( @event.get('[@metadata][jms_timestamp]') ).to eql jms_timestamp
|
301
|
+
expect( @event.get('[@metadata][jms_message_id]') ).to_not be nil
|
302
|
+
end
|
303
|
+
|
304
|
+
it 'sets properties as meta-data' do
|
305
|
+
expect( @event.get('[@metadata][foo]') ).to eql 'bar'
|
306
|
+
expect( @event.get('[@metadata][the-baz]') ).to eql 42
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|
310
|
+
|
311
|
+
end
|
256
312
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-jms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1
|
4
|
+
version: 3.2.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elasticsearch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,17 +61,45 @@ dependencies:
|
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - "
|
64
|
+
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
67
|
-
name:
|
66
|
+
version: '1.3'
|
67
|
+
name: logstash-mixin-ecs_compatibility_support
|
68
68
|
prerelease: false
|
69
69
|
type: :runtime
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- - "
|
72
|
+
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
74
|
+
version: '1.3'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '1.0'
|
81
|
+
name: logstash-mixin-event_support
|
82
|
+
prerelease: false
|
83
|
+
type: :runtime
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
requirement: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '1.0'
|
95
|
+
name: logstash-mixin-validator_support
|
96
|
+
prerelease: false
|
97
|
+
type: :runtime
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '1.0'
|
75
103
|
- !ruby/object:Gem::Dependency
|
76
104
|
requirement: !ruby/object:Gem::Requirement
|
77
105
|
requirements:
|
@@ -86,6 +114,20 @@ dependencies:
|
|
86
114
|
- - ">="
|
87
115
|
- !ruby/object:Gem::Version
|
88
116
|
version: 1.2.0
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
requirement: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - "<"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 4.0.0
|
123
|
+
name: semantic_logger
|
124
|
+
prerelease: false
|
125
|
+
type: :runtime
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "<"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 4.0.0
|
89
131
|
- !ruby/object:Gem::Dependency
|
90
132
|
requirement: !ruby/object:Gem::Requirement
|
91
133
|
requirements:
|
@@ -144,8 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
186
|
- !ruby/object:Gem::Version
|
145
187
|
version: '0'
|
146
188
|
requirements: []
|
147
|
-
|
148
|
-
rubygems_version: 2.6.13
|
189
|
+
rubygems_version: 3.1.6
|
149
190
|
signing_key:
|
150
191
|
specification_version: 4
|
151
192
|
summary: Reads events from a Jms Broker
|