ruby-kafka 0.3.16.beta2 → 0.3.16

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
  SHA1:
3
- metadata.gz: aa43ca9dd13cdd1f9f06db58d0799c91dfadf9b2
4
- data.tar.gz: 5ca2bc1cf1771373ea10b5e0e8c03a76f048404a
3
+ metadata.gz: 02443c4134a1dd98934b6bd2f73b2edc09fe4cf5
4
+ data.tar.gz: b03995318665f91f070ecb00a14aa483e4c4444e
5
5
  SHA512:
6
- metadata.gz: efe7d3b0674fd2ad39e41d1ae0638de877f1ec7a4dd5ed920f566802ee92741350beaba377d040a5b08b35891631a0a11eed4752aaf42ee47019ac62e4f1bc0d
7
- data.tar.gz: dec596d15cb047bc7d8c15d2aeed8f952ff098a01a44792da7fb915b87b96d6e8edefdcc94dabf861ac2060f1c535db01eb8a60735fa9dbacd9e5849f6d63c18
6
+ metadata.gz: 2c69cb9baa6eed992cdd7dc66b14547df32059144748b0c12fe269ec126bbd4ed62b18300aacb955f62b17235e26e605cfea53425adf278a57edcb99d4e7c272
7
+ data.tar.gz: d2b7dd37bc7eb3ac6666808172d289334d926d9cb17b01690c19e1f67174af4f054c003fcc204fb9f711441d4207a4693e2d54419af873930306ae9f2fe8d1a0
data/CHANGELOG.md CHANGED
@@ -4,7 +4,7 @@ Changes and additions to the library will be listed here.
4
4
 
5
5
  ## Unreleased
6
6
 
7
- ## v0.3.16.beta1
7
+ ## v0.3.16
8
8
 
9
9
  - Fix SSL socket timeout (#283).
10
10
  - Update to the latest Datadog gem (#296).
@@ -67,7 +67,7 @@ module Kafka
67
67
  # Typically you either want to start reading messages from the very
68
68
  # beginning of the topic's partitions or you simply want to wait for new
69
69
  # messages to be written. In the former case, set `start_from_beginning`
70
- # true (the default); in the latter, set it to false.
70
+ # to true (the default); in the latter, set it to false.
71
71
  #
72
72
  # @param topic [String] the name of the topic to subscribe to.
73
73
  # @param default_offset [Symbol] whether to start from the beginning or the
@@ -105,7 +105,8 @@ module Kafka
105
105
  #
106
106
  # @param topic [String]
107
107
  # @param partition [Integer]
108
- # @param timeout [Integer] the number of seconds to pause the partition for.
108
+ # @param timeout [Integer] the number of seconds to pause the partition for,
109
+ # or `nil` if the partition should not be automatically resumed.
109
110
  # @return [nil]
110
111
  def pause(topic, partition, timeout: nil)
111
112
  @paused_partitions[topic] ||= {}
@@ -164,7 +165,7 @@ module Kafka
164
165
  # @param min_bytes [Integer] the minimum number of bytes to read before
165
166
  # returning messages from the server; if `max_wait_time` is reached, this
166
167
  # is ignored.
167
- # @param max_wait_time [Integer] the maximum duration of time to wait before
168
+ # @param max_wait_time [Integer, Float] the maximum duration of time to wait before
168
169
  # returning messages from the server, in seconds.
169
170
  # @yieldparam message [Kafka::FetchedMessage] a message fetched from Kafka.
170
171
  # @raise [Kafka::ProcessingError] if there was an error processing a message.
@@ -227,7 +228,7 @@ module Kafka
227
228
  # @param min_bytes [Integer] the minimum number of bytes to read before
228
229
  # returning messages from the server; if `max_wait_time` is reached, this
229
230
  # is ignored.
230
- # @param max_wait_time [Integer] the maximum duration of time to wait before
231
+ # @param max_wait_time [Integer, Float] the maximum duration of time to wait before
231
232
  # returning messages from the server, in seconds.
232
233
  # @yieldparam batch [Kafka::FetchedBatch] a message batch fetched from Kafka.
233
234
  # @return [nil]
@@ -318,11 +319,11 @@ module Kafka
318
319
  def fetch_batches(min_bytes:, max_wait_time:)
319
320
  join_group unless @group.member?
320
321
 
321
- assigned_partitions = @group.assigned_partitions
322
+ subscribed_partitions = @group.subscribed_partitions
322
323
 
323
324
  @heartbeat.send_if_necessary
324
325
 
325
- raise "No partitions assigned!" if assigned_partitions.empty?
326
+ raise "No partitions assigned!" if subscribed_partitions.empty?
326
327
 
327
328
  operation = FetchOperation.new(
328
329
  cluster: @cluster,
@@ -331,7 +332,7 @@ module Kafka
331
332
  max_wait_time: max_wait_time,
332
333
  )
333
334
 
334
- assigned_partitions.each do |topic, partitions|
335
+ subscribed_partitions.each do |topic, partitions|
335
336
  partitions.each do |partition|
336
337
  offset = @offset_manager.next_offset_for(topic, partition)
337
338
  max_bytes = @max_bytes.fetch(topic)
@@ -23,6 +23,10 @@ module Kafka
23
23
  @cluster.add_target_topics([topic])
24
24
  end
25
25
 
26
+ def subscribed_partitions
27
+ @assigned_partitions.select { |topic, _| @topics.include?(topic) }
28
+ end
29
+
26
30
  def member?
27
31
  !@generation_id.nil?
28
32
  end
@@ -7,22 +7,24 @@ module Kafka
7
7
  #
8
8
  # ## Instrumentation
9
9
  #
10
- # When executing the operation, an `ack_messages.producer.kafka` notification will be
11
- # emitted for each message set that was successfully appended to a topic partition.
10
+ # When executing the operation, an `ack_message.producer.kafka` notification will be
11
+ # emitted for each message that was successfully appended to a topic partition.
12
12
  # The following keys will be found in the payload:
13
13
  #
14
14
  # * `:topic` — the topic that was written to.
15
15
  # * `:partition` — the partition that the message set was appended to.
16
- # * `:offset` — the offset of the first message in the message set.
17
- # * `:message_count` — the number of messages that were appended.
16
+ # * `:offset` — the offset of the message in the partition.
17
+ # * `:key` — the message key.
18
+ # * `:value` — the message value.
19
+ # * `:delay` — the time between the message was produced and when it was acknowledged.
18
20
  #
19
21
  # In addition to these notifications, a `send_messages.producer.kafka` notification will
20
22
  # be emitted after the operation completes, regardless of whether it succeeds. This
21
23
  # notification will have the following keys:
22
24
  #
23
- # * `message_count` – the total number of messages that the operation tried to
25
+ # * `:message_count` – the total number of messages that the operation tried to
24
26
  # send. Note that not all messages may get delivered.
25
- # * `sent_message_count` – the number of messages that were successfully sent.
27
+ # * `:sent_message_count` – the number of messages that were successfully sent.
26
28
  #
27
29
  class ProduceOperation
28
30
  def initialize(cluster:, buffer:, compressor:, required_acks:, ack_timeout:, logger:, instrumenter:)
@@ -125,12 +127,13 @@ module Kafka
125
127
  raise e
126
128
  end
127
129
 
128
- messages.each do |message|
130
+ messages.each_with_index do |message, index|
129
131
  @instrumenter.instrument("ack_message.producer", {
130
132
  key: message.key,
131
133
  value: message.value,
132
134
  topic: topic,
133
135
  partition: partition,
136
+ offset: partition_info.offset + index,
134
137
  delay: ack_time - message.create_time,
135
138
  })
136
139
  end
data/lib/kafka/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kafka
2
- VERSION = "0.3.16.beta2"
2
+ VERSION = "0.3.16"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.16.beta2
4
+ version: 0.3.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schierbeck
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-19 00:00:00.000000000 Z
11
+ date: 2017-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -314,9 +314,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
314
314
  version: 2.1.0
315
315
  required_rubygems_version: !ruby/object:Gem::Requirement
316
316
  requirements:
317
- - - ">"
317
+ - - ">="
318
318
  - !ruby/object:Gem::Version
319
- version: 1.3.1
319
+ version: '0'
320
320
  requirements: []
321
321
  rubyforge_project:
322
322
  rubygems_version: 2.4.5.1
@@ -324,4 +324,3 @@ signing_key:
324
324
  specification_version: 4
325
325
  summary: A client library for the Kafka distributed commit log.
326
326
  test_files: []
327
- has_rdoc: