ruby-kafka 0.4.0.beta1 → 0.4.0

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: 9ac9f20c365f90e85bd6df6000838fbc349b893b
4
- data.tar.gz: fc16d9bf3784a21d1a82ec106b5b528bf57bfbe2
3
+ metadata.gz: 8e5c2b78f0d4883922641e90ac150a738959c00e
4
+ data.tar.gz: 0166be6c6bef06356abdf4f771dd633043e996ba
5
5
  SHA512:
6
- metadata.gz: 22c77ea79b8e971916e1671253b709b207501a3e068d29e5629efea30733e9ab224748f068cc916c6472f7507c2e1073f7b0a3e9ee2cdbcafee21bd27e21f277
7
- data.tar.gz: e5ecd931e2348ee989bcaf70387b30e64d9b24560231745b1c4d0e275cfcc0f65202cdf018b45bcc1678699ac05648bb4f0a5e5689eee030958823a864e73fb1
6
+ metadata.gz: 1207e355018718c240fabd89ba2286949dc156f5ce9734f9cf48635154ee9d20587d4401e4ca8c5f31edb4fda3b1e049766ad0a93030b5df99b8762e160f5970
7
+ data.tar.gz: 3c7b974bf3347c841d9bd85118dc8bf66dc892f6c48df7fc32599949bca6b1bf71d301559ce28709eac108dd92acced6a9f15557226d12d0c3311ac4b3c1115e
@@ -334,11 +334,19 @@ module Kafka
334
334
 
335
335
  def assign_partitions!
336
336
  failed_messages = []
337
+ topics_with_failures = Set.new
337
338
 
338
339
  @pending_message_queue.each do |message|
339
340
  partition = message.partition
340
341
 
341
342
  begin
343
+ # If a message for a topic fails to receive a partition all subsequent
344
+ # messages for the topic should be retried to preserve ordering
345
+ if topics_with_failures.include?(message.topic)
346
+ failed_messages << message
347
+ next
348
+ end
349
+
342
350
  if partition.nil?
343
351
  partition_count = @cluster.partitions_for(message.topic).count
344
352
  partition = Partitioner.partition_for_key(partition_count, message)
@@ -357,6 +365,7 @@ module Kafka
357
365
  exception: [e.class.to_s, e.message],
358
366
  })
359
367
 
368
+ topics_with_failures << message.topic
360
369
  failed_messages << message
361
370
  end
362
371
  end
@@ -3,19 +3,32 @@ module Kafka
3
3
  # The replica id of non-brokers is always -1.
4
4
  REPLICA_ID = -1
5
5
 
6
+ PRODUCE_API = 0
7
+ FETCH_API = 1
8
+ LIST_OFFSET_API = 2
9
+ TOPIC_METADATA_API = 3
10
+ OFFSET_COMMIT_API = 8
11
+ OFFSET_FETCH_API = 9
12
+ GROUP_COORDINATOR_API = 10
13
+ JOIN_GROUP_API = 11
14
+ HEARTBEAT_API = 12
15
+ LEAVE_GROUP_API = 13
16
+ SYNC_GROUP_API = 14
17
+ SASL_HANDSHAKE_API = 17
18
+
6
19
  APIS = {
7
- 0 => :produce,
8
- 1 => :fetch,
9
- 2 => :list_offset,
10
- 3 => :topic_metadata,
11
- 8 => :offset_commit,
12
- 9 => :offset_fetch,
13
- 10 => :group_coordinator,
14
- 11 => :join_group,
15
- 12 => :heartbeat,
16
- 13 => :leave_group,
17
- 14 => :sync_group,
18
- 17 => :sasl_handshake
20
+ PRODUCE_API => :produce,
21
+ FETCH_API => :fetch,
22
+ LIST_OFFSET_API => :list_offset,
23
+ TOPIC_METADATA_API => :topic_metadata,
24
+ OFFSET_COMMIT_API => :offset_commit,
25
+ OFFSET_FETCH_API => :offset_fetch,
26
+ GROUP_COORDINATOR_API => :group_coordinator,
27
+ JOIN_GROUP_API => :join_group,
28
+ HEARTBEAT_API => :heartbeat,
29
+ LEAVE_GROUP_API => :leave_group,
30
+ SYNC_GROUP_API => :sync_group,
31
+ SASL_HANDSHAKE_API => :sasl_handshake,
19
32
  }
20
33
 
21
34
  ERRORS = {
@@ -27,7 +27,7 @@ module Kafka
27
27
  end
28
28
 
29
29
  def api_key
30
- 1
30
+ FETCH_API
31
31
  end
32
32
 
33
33
  def response_class
@@ -6,7 +6,7 @@ module Kafka
6
6
  end
7
7
 
8
8
  def api_key
9
- 10
9
+ GROUP_COORDINATOR_API
10
10
  end
11
11
 
12
12
  def encode(encoder)
@@ -8,7 +8,7 @@ module Kafka
8
8
  end
9
9
 
10
10
  def api_key
11
- 12
11
+ HEARTBEAT_API
12
12
  end
13
13
 
14
14
  def response_class
@@ -16,7 +16,7 @@ module Kafka
16
16
  end
17
17
 
18
18
  def api_key
19
- 11
19
+ JOIN_GROUP_API
20
20
  end
21
21
 
22
22
  def response_class
@@ -7,7 +7,7 @@ module Kafka
7
7
  end
8
8
 
9
9
  def api_key
10
- 13
10
+ LEAVE_GROUP_API
11
11
  end
12
12
 
13
13
  def response_class
@@ -20,7 +20,7 @@ module Kafka
20
20
  end
21
21
 
22
22
  def api_key
23
- 2
23
+ LIST_OFFSET_API
24
24
  end
25
25
 
26
26
  def response_class
@@ -5,7 +5,7 @@ module Kafka
5
5
  DEFAULT_RETENTION_TIME = -1
6
6
 
7
7
  def api_key
8
- 8
8
+ OFFSET_COMMIT_API
9
9
  end
10
10
 
11
11
  def api_version
@@ -7,7 +7,7 @@ module Kafka
7
7
  end
8
8
 
9
9
  def api_key
10
- 9
10
+ OFFSET_FETCH_API
11
11
  end
12
12
 
13
13
  def api_version
@@ -37,7 +37,7 @@ module Kafka
37
37
  end
38
38
 
39
39
  def api_key
40
- 0
40
+ PRODUCE_API
41
41
  end
42
42
 
43
43
  def response_class
@@ -16,7 +16,7 @@ module Kafka
16
16
  end
17
17
 
18
18
  def api_key
19
- 17
19
+ SASL_HANDSHAKE_API
20
20
  end
21
21
 
22
22
  def response_class
@@ -9,7 +9,7 @@ module Kafka
9
9
  end
10
10
 
11
11
  def api_key
12
- 14
12
+ SYNC_GROUP_API
13
13
  end
14
14
 
15
15
  def response_class
@@ -10,7 +10,7 @@ module Kafka
10
10
  end
11
11
 
12
12
  def api_key
13
- 3
13
+ TOPIC_METADATA_API
14
14
  end
15
15
 
16
16
  def response_class
@@ -1,3 +1,3 @@
1
1
  module Kafka
2
- VERSION = "0.4.0.beta1"
2
+ VERSION = "0.4.0"
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.4.0.beta1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schierbeck
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-18 00:00:00.000000000 Z
11
+ date: 2017-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gssapi
@@ -357,9 +357,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
357
357
  version: 2.1.0
358
358
  required_rubygems_version: !ruby/object:Gem::Requirement
359
359
  requirements:
360
- - - ">"
360
+ - - ">="
361
361
  - !ruby/object:Gem::Version
362
- version: 1.3.1
362
+ version: '0'
363
363
  requirements: []
364
364
  rubyforge_project:
365
365
  rubygems_version: 2.4.5.1