heller 0.2.0-java → 0.2.1-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
  SHA1:
3
- metadata.gz: eb77b9b32f52f9f8cb4aefbdf3d27af37b402283
4
- data.tar.gz: dcf3fbab3d4ee6cb31f0da70e98f18fe3994b2b6
3
+ metadata.gz: 0baa0412f9823d69c62d8688ef830862fc3d29e8
4
+ data.tar.gz: 560b7dcbc5b86938368606b3a9cf22caca01ec7a
5
5
  SHA512:
6
- metadata.gz: 8a4b163c1f7523d3035cf73087b8d26dc366845b66c3c39845e9476fcb9d00b32944a7307a9e746deb833db722605290e2576322116b0a5ccbd65bb68027d6f1
7
- data.tar.gz: 9658bb7e731c353d0269bcce8c150c7f47883d21bf0c592d937eaab50c641b0f064037dabe846698443d2acc7987995eb9084152aac60f2d5b06ed9bd4d5fa9d
6
+ metadata.gz: ae0a5cf3dc94c7e4db90a8fd842ca0a43e5050130e6150d9b9b1d365864d2d7e0927abc5875e6953bdbc55e13e263a83e2f0880644e59705095e834bb23dd4bb
7
+ data.tar.gz: 4ac4c3b9f0d244ebd16105e15048b8d1c29cb0baae4e5e27ceba1c87a388b0ec76b9d383f0dccbc0bf0ce55a8642125584e4cf0959db4939f86d0f8f2e3dfaf7
@@ -56,6 +56,8 @@ module Heller
56
56
 
57
57
  def disconnect
58
58
  @consumer.close
59
+ Kafka::Metrics::KafkaMetricsGroup.remove_all_consumer_metrics(client_id)
60
+ nil
59
61
  end
60
62
  alias_method :close, :disconnect
61
63
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Heller
4
- VERSION = '0.2.0'.freeze
4
+ VERSION = '0.2.1'.freeze
5
5
  end
@@ -42,6 +42,16 @@ module Kafka
42
42
  java_import 'kafka.javaapi.message.ByteBufferMessageSet'
43
43
  end
44
44
 
45
+ module Metrics
46
+ java_import 'kafka.metrics.KafkaMetricsGroup'
47
+
48
+ module KafkaMetricsGroup
49
+ def self.remove_all_consumer_metrics(client_id)
50
+ self.removeAllConsumerMetrics(client_id)
51
+ end
52
+ end
53
+ end
54
+
45
55
  module Producer
46
56
  java_import 'kafka.javaapi.producer.Producer'
47
57
  java_import 'kafka.producer.ProducerConfig'
@@ -366,11 +366,29 @@ module Heller
366
366
  expect(consumer_spy).to have_received(:close)
367
367
  end
368
368
 
369
+ it 'removes any metrics associated with the underlying consumer' do
370
+ consumer = described_class.new('localhost:9092', client_id: 'metrics-removal')
371
+ before = Java::ComYammerMetrics::Metrics.default_registry.all_metrics
372
+ expect(before).to_not be_empty
373
+ consumer.close
374
+ after = Java::ComYammerMetrics::Metrics.default_registry.all_metrics
375
+ expect(after).to be_empty
376
+ end
377
+
369
378
  it 'is aliased to #close' do
370
379
  consumer.close
371
380
 
372
381
  expect(consumer_spy).to have_received(:close)
373
382
  end
383
+
384
+ it 'returns nil' do
385
+ expect(consumer.close).to be_nil
386
+ end
387
+
388
+ it 'is okay to call multiple times' do
389
+ consumer = described_class.new('localhost:9092', client_id: 'close-multiple')
390
+ 3.times { consumer.close }
391
+ end
374
392
  end
375
393
  end
376
394
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: java
6
6
  authors:
7
7
  - Mathias Söderberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-13 00:00:00.000000000 Z
11
+ date: 2015-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement