logstash-input-azure_event_hubs 1.4.8 → 1.4.9
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/VERSION +1 -1
- data/lib/logstash/inputs/azure_event_hubs.rb +35 -14
- data/spec/inputs/azure_event_hub_spec.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6df7b5517ace2611b9fe482c3614e7955d31a2f43ba03b906e1426c0d475526
|
4
|
+
data.tar.gz: 7313f77d50d78a426238edba6d06c1ff1a9f199099db87c1e3c183f2856758f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e3c437f56a83bc77d5d249d4879aa1d9e6f37c6c4a0730e49a73144aeca6edccde825f1cf4094f461d7ab1f78f3f88f8cc7838b62f1b063246673692cf00572
|
7
|
+
data.tar.gz: 87d3c7871814028f4ec7036460d3895111b2d86477f88a93038e89f4282bf61cae589f1806f7a66021122ac812dcc07958e63cf75142540efa021463de76f069
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 1.4.9
|
2
|
+
- Fixed issue with `getHostContext` method accessibility, causing plugin not to be able to run [#93](https://github.com/logstash-plugins/logstash-input-azure_event_hubs/pull/93)
|
3
|
+
|
1
4
|
## 1.4.8
|
2
5
|
- Fixed connection placeholder replacements errors with Logstash `8.15.1` and `8.15.2` [#92](https://github.com/logstash-plugins/logstash-input-azure_event_hubs/pull/92)
|
3
6
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.9
|
@@ -411,20 +411,7 @@ class LogStash::Inputs::AzureEventHubs < LogStash::Inputs::Base
|
|
411
411
|
scheduled_executor_service)
|
412
412
|
else
|
413
413
|
@logger.warn("You have NOT specified a `storage_connection_string` for #{event_hub_name}. This configuration is only supported for a single Logstash instance.")
|
414
|
-
|
415
|
-
lease_manager = InMemoryLeaseManager.new
|
416
|
-
event_processor_host = EventProcessorHost.new(
|
417
|
-
EventProcessorHost.createHostName('logstash'),
|
418
|
-
event_hub_name,
|
419
|
-
event_hub['consumer_group'],
|
420
|
-
event_hub['event_hub_connections'].first.value, #there will only be one in this array by the time it gets here
|
421
|
-
checkpoint_manager,
|
422
|
-
lease_manager,
|
423
|
-
scheduled_executor_service,
|
424
|
-
nil)
|
425
|
-
#using java_send to avoid naming conflicts with 'initialize' method
|
426
|
-
lease_manager.java_send :initialize, [HostContext], event_processor_host.getHostContext
|
427
|
-
checkpoint_manager.java_send :initialize, [HostContext], event_processor_host.getHostContext
|
414
|
+
event_processor_host = create_in_memory_event_processor_host(event_hub, event_hub_name, scheduled_executor_service)
|
428
415
|
end
|
429
416
|
options = EventProcessorOptions.new
|
430
417
|
options.setMaxBatchSize(max_batch_size)
|
@@ -496,4 +483,38 @@ class LogStash::Inputs::AzureEventHubs < LogStash::Inputs::Base
|
|
496
483
|
@logger.debug("interrupted while waiting to close executor service, this can generally be ignored", :exception => e, :backtrace => e.backtrace) if e
|
497
484
|
end
|
498
485
|
end
|
486
|
+
|
487
|
+
def create_in_memory_event_processor_host(event_hub, event_hub_name, scheduled_executor_service)
|
488
|
+
checkpoint_manager = InMemoryCheckpointManager.new
|
489
|
+
lease_manager = InMemoryLeaseManager.new
|
490
|
+
event_processor_host = EventProcessorHost.new(
|
491
|
+
EventProcessorHost.createHostName('logstash'),
|
492
|
+
event_hub_name,
|
493
|
+
event_hub['consumer_group'],
|
494
|
+
event_hub['event_hub_connections'].first.value, #there will only be one in this array by the time it gets here
|
495
|
+
checkpoint_manager,
|
496
|
+
lease_manager,
|
497
|
+
scheduled_executor_service,
|
498
|
+
nil)
|
499
|
+
host_context = get_host_context(event_processor_host)
|
500
|
+
#using java_send to avoid naming conflicts with 'initialize' method
|
501
|
+
lease_manager.java_send :initialize, [HostContext], host_context
|
502
|
+
checkpoint_manager.java_send :initialize, [HostContext], host_context
|
503
|
+
event_processor_host
|
504
|
+
end
|
505
|
+
|
506
|
+
private
|
507
|
+
|
508
|
+
# This method is used to get around the fact that recent versions of jruby do not
|
509
|
+
# allow access to the package private protected method `getHostContext`
|
510
|
+
def get_host_context(event_processor_host)
|
511
|
+
call_private(event_processor_host, 'getHostContext')
|
512
|
+
end
|
513
|
+
|
514
|
+
def call_private(clazz, method)
|
515
|
+
method = clazz.java_class.declared_method(method)
|
516
|
+
method.accessible = true
|
517
|
+
method.invoke(clazz)
|
518
|
+
end
|
519
|
+
|
499
520
|
end
|
@@ -207,10 +207,10 @@ describe LogStash::Inputs::AzureEventHubs do
|
|
207
207
|
register_counter = java.util.concurrent.atomic.AtomicInteger.new
|
208
208
|
unregister_counter = java.util.concurrent.atomic.AtomicInteger.new
|
209
209
|
assertion_count = java.util.concurrent.atomic.AtomicInteger.new
|
210
|
+
allow(input).to receive(:get_host_context) {mock_host_context}
|
210
211
|
allow_any_instance_of(InMemoryLeaseManager).to receive(:java_send)
|
211
212
|
allow_any_instance_of(InMemoryCheckpointManager).to receive(:java_send)
|
212
213
|
|
213
|
-
allow(mock_host).to receive(:getHostContext) {mock_host_context}
|
214
214
|
allow(mock_host_context).to receive(:getEventHubPath) {"foo"}
|
215
215
|
|
216
216
|
expect(mock_host).to receive(:registerEventProcessorFactory).at_most(3).times {
|
@@ -256,6 +256,11 @@ describe LogStash::Inputs::AzureEventHubs do
|
|
256
256
|
expect(assertion_count.get).to be == 3
|
257
257
|
end
|
258
258
|
|
259
|
+
it "can create an in memory EPH" do
|
260
|
+
#event_hub, event_hub_name, scheduled_executor_service
|
261
|
+
exploded_config = input.event_hubs_exploded
|
262
|
+
input.create_in_memory_event_processor_host(exploded_config[0], exploded_config[0]['event_hubs'].first, nil)
|
263
|
+
end
|
259
264
|
end
|
260
265
|
|
261
266
|
describe "Bad Basic Config" do
|