kafka 0.5.0 → 0.5.1

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: b1ff8fcc9cb3c43bd818733a5af934490298e0fc28a54668bb4a47d24abe8c69
4
- data.tar.gz: 9ca67cd457ceadaffaea6bdb2b1c61d1f4481aa3e2a0ce3874bfb251c3ae9e1f
3
+ metadata.gz: a6970af4b6ef931eb091068ee75220a2ce7a3f79a3afa7abd0dc40c9b6f88a18
4
+ data.tar.gz: cdda5ed68a3f9310fe6ce33930d3ebff71f5d9c53b735c2412e6a72fce9ba546
5
5
  SHA512:
6
- metadata.gz: 0ecdfd53f2621b6f876595a159847683a8360d2cfa675b0161db5baf688415f2d65c195848d0835c8dbd2aad06ed3377d54dde463bad3e83968893778ef143c6
7
- data.tar.gz: c56a0ceafce7c89761aad6da5bdd45ca0da82a765d7072ea472abd6c8fc585dceebaf8f37f2783ea8cccb18205f58f0ef883f16472a8693860a59bcb1697b49a
6
+ metadata.gz: 1cd6d75ccbb42e8d37d763f542c5c267fae092bb26558057f2f3b04de92d27021b4a57361ccf12ea40a8ebfcc234a651b27c71341ecb57327e9cbd32c486105f
7
+ data.tar.gz: 7cc3f4d3b70f11b20af2ed8d6fce065d8abdf5a53c5ab60bb39cfbb59c1a306b6eb876337bc2b7370bd83377934942e24868c46db5b511766a5f7296f2bea7bf
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## Unreleased
2
+
3
+ ## 0.5.1 / 2020-01-22
4
+
5
+ * Kafka::Consumer now uses poll_set_consumer instead of a Poller thread
6
+ * Add #latency to DeliverReport to get how long message took to be delivered.
7
+
1
8
  ## 0.5.0 / 2020-01-21
2
9
 
3
10
  * Initial release!
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Kafka
2
2
 
3
3
  [![Build Status](https://travis-ci.com/deadmanssnitch/kafka.svg?branch=master)](https://travis-ci.com/deadmanssnitch/kafka)
4
+ [![Gem Version](https://badge.fury.io/rb/kafka.svg)](https://badge.fury.io/rb/kafka)
4
5
 
5
6
  The kafka gem provides a general producer and consumer for
6
7
  [Apache Kafka](https://kafka.apache.org) using bindings to the official
data/examples/producer.rb CHANGED
@@ -29,7 +29,6 @@ workers = 8.times.map do |i|
29
29
  while @run
30
30
  producer.produce("ruby_test_topic", "#{i}: #{SecureRandom.uuid}") do |report|
31
31
  # Wait for delivery confirmation from the cluster
32
- report.wait
33
32
  puts report.inspect
34
33
  end
35
34
 
data/kafka.gemspec CHANGED
@@ -14,13 +14,17 @@ Gem::Specification.new do |spec|
14
14
  consumer implementation.
15
15
  DESCRIPTION
16
16
 
17
- spec.homepage = "http://github.com/deadmanssnitch/kafka"
17
+ spec.homepage = "https://deadmanssnitch.com/opensource/kafka"
18
18
  spec.license = "MIT"
19
19
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
20
20
 
21
- spec.metadata["homepage_uri"] = spec.homepage
22
- spec.metadata["source_code_uri"] = spec.homepage
23
- spec.metadata["changelog_uri"] = "https://github.com/deadmanssnitch/kafka/blob/master/CHANGELOG.md"
21
+ spec.metadata = {
22
+ "homepage_uri" => spec.homepage,
23
+ "bug_tracker_uri" => "https://github.com/deadmanssnitch/kafka/issues",
24
+ "source_code_uri" => "https://github.com/deadmanssnitch/kafka",
25
+ "documentation_uri" => "https://deadmanssnitch.com/opensource/kafka/docs/",
26
+ "changelog_uri" => "https://github.com/deadmanssnitch/kafka/blob/master/CHANGELOG.md",
27
+ }
24
28
 
25
29
  # Specify which files should be added to the gem when it is released.
26
30
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -18,8 +18,9 @@ module Kafka
18
18
  # Initialize the client
19
19
  @client = Kafka::FFI::Consumer.new(config)
20
20
 
21
- # Event loop polling for events so callbacks are fired.
22
- @poller = Poller.new(@client)
21
+ # Redirect the main event queue so calls to consumer_poll will fire
22
+ # callbacks instead of having to have a separate poller thread.
23
+ @client.poll_set_consumer
23
24
  end
24
25
 
25
26
  # Subscribe the consumer to the given list of topics. Once the
@@ -71,7 +72,6 @@ module Kafka
71
72
  # Consumer.
72
73
  def close
73
74
  # @see https://github.com/edenhill/librdkafka/blob/master/INTRODUCTION.md#high-level-kafkaconsumer
74
- @poller.stop
75
75
 
76
76
  # Gracefully shutdown the consumer, leaving the consumer group,
77
77
  # committing any remaining offsets, and releasing resources back to the
@@ -19,6 +19,17 @@ class Kafka::Producer
19
19
  # @return [Integer] Partition the message was delivered to.
20
20
  attr_reader :partition
21
21
 
22
+ # Returns the number of microseconds since the message was enqueued for
23
+ # delivery until the message was confirmed by the cluster or permanently
24
+ # failed.
25
+ #
26
+ # @note Latency is in microseconds (μs) while most other timestamps are in
27
+ # milliseconds.
28
+ #
29
+ # @return [nil] Latency was not available
30
+ # @return [Integer] Time since message was produced in microseconds
31
+ attr_reader :latency
32
+
22
33
  # Initializes a new DeliveryReport
23
34
  #
24
35
  # @param block [Proc] Callback to call with the DeliveryReport when it is
@@ -30,6 +41,7 @@ class Kafka::Producer
30
41
  @error = nil
31
42
  @topic = nil
32
43
  @offset = nil
44
+ @latency = nil
33
45
  @partition = nil
34
46
  @callback = block
35
47
 
@@ -73,6 +85,7 @@ class Kafka::Producer
73
85
  @offset = message.offset
74
86
  @topic = message.topic
75
87
  @partition = message.partition
88
+ @latency = message.latency
76
89
 
77
90
  @done = true
78
91
  @waiter.broadcast
data/lib/kafka/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kafka
4
- VERSION = "0.5.0"
4
+ VERSION = "0.5.1"
5
5
 
6
6
  LIBRDKAFKA_VERSION = "1.3.0"
7
7
  LIBRDKAFKA_CHECKSUM = "465cab533ebc5b9ca8d97c90ab69e0093460665ebaf38623209cf343653c76d2"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Gaffney
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-21 00:00:00.000000000 Z
11
+ date: 2020-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -130,12 +130,14 @@ files:
130
130
  - lib/kafka/producer.rb
131
131
  - lib/kafka/producer/delivery_report.rb
132
132
  - lib/kafka/version.rb
133
- homepage: http://github.com/deadmanssnitch/kafka
133
+ homepage: https://deadmanssnitch.com/opensource/kafka
134
134
  licenses:
135
135
  - MIT
136
136
  metadata:
137
- homepage_uri: http://github.com/deadmanssnitch/kafka
138
- source_code_uri: http://github.com/deadmanssnitch/kafka
137
+ homepage_uri: https://deadmanssnitch.com/opensource/kafka
138
+ bug_tracker_uri: https://github.com/deadmanssnitch/kafka/issues
139
+ source_code_uri: https://github.com/deadmanssnitch/kafka
140
+ documentation_uri: https://deadmanssnitch.com/opensource/kafka/docs/
139
141
  changelog_uri: https://github.com/deadmanssnitch/kafka/blob/master/CHANGELOG.md
140
142
  post_install_message:
141
143
  rdoc_options: []