ruby-kafka 0.5.3 → 0.5.4.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/lib/kafka/broker.rb +7 -2
- data/lib/kafka/client.rb +19 -6
- data/lib/kafka/cluster.rb +2 -1
- data/lib/kafka/protocol/create_topics_request.rb +4 -1
- data/lib/kafka/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3f2428155820ec46ad40498451f7b856e2a57b4a611a20f92e855bb9f823293c
|
4
|
+
data.tar.gz: ecaff2f5cc423e696864e02ff0179e4ba35b7669d04c5a5e26599b673c193482
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0f41a3e496158c497baa2acfbc1d86e7f6950f1fcddba614f7f082c58c8b710a27caf44913ba5c28b7b1f212a25b9626ff58c550f59a32829050309218e21cf
|
7
|
+
data.tar.gz: 8efe6b6cf6ec7835d404c40eaead957e4fd4232bf1a73349d49cd79cca4131228aa2eb82ccc090504b317bd6556570841ea8af21e374f3f6bff54e1b429e95b1
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@ Changes and additions to the library will be listed here.
|
|
4
4
|
|
5
5
|
## Unreleased
|
6
6
|
|
7
|
+
- Add support for config entries in the topic creation API.
|
8
|
+
- Don't fail on retry when the cluster is secured (#545).
|
9
|
+
|
10
|
+
## v0.5.3
|
11
|
+
|
7
12
|
- Add support for the topic deletion API (#528).
|
8
13
|
- Add support for the partition creation API (#533).
|
9
14
|
- Allow passing in the seed brokers in a positional argument (#538).
|
data/lib/kafka/broker.rb
CHANGED
@@ -19,12 +19,17 @@ module Kafka
|
|
19
19
|
|
20
20
|
# @return [String]
|
21
21
|
def to_s
|
22
|
-
"#{
|
22
|
+
"#{@host}:#{@port} (node_id=#{@node_id.inspect})"
|
23
23
|
end
|
24
24
|
|
25
25
|
# @return [nil]
|
26
26
|
def disconnect
|
27
|
-
connection.close
|
27
|
+
connection.close if connected?
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [Boolean]
|
31
|
+
def connected?
|
32
|
+
!@connection.nil?
|
28
33
|
end
|
29
34
|
|
30
35
|
# Fetches cluster metadata from the broker.
|
data/lib/kafka/client.rb
CHANGED
@@ -405,10 +405,7 @@ module Kafka
|
|
405
405
|
# @param topic [String] the topic to consume messages from.
|
406
406
|
#
|
407
407
|
# @param start_from_beginning [Boolean] whether to start from the beginning
|
408
|
-
# of the topic or just subscribe to new messages being produced.
|
409
|
-
# only applies when first consuming a topic partition – once the consumer
|
410
|
-
# has checkpointed its progress, it will always resume from the last
|
411
|
-
# checkpoint.
|
408
|
+
# of the topic or just subscribe to new messages being produced.
|
412
409
|
#
|
413
410
|
# @param max_wait_time [Integer] the maximum amount of time to wait before
|
414
411
|
# the server responds, in seconds.
|
@@ -451,16 +448,32 @@ module Kafka
|
|
451
448
|
|
452
449
|
# Creates a topic in the cluster.
|
453
450
|
#
|
451
|
+
# @example Creating a topic with log compaction
|
452
|
+
# # Enable log compaction:
|
453
|
+
# config = { "cleanup.policy" => "compact" }
|
454
|
+
#
|
455
|
+
# # Create the topic:
|
456
|
+
# kafka.create_topic("dns-mappings", config: config)
|
457
|
+
#
|
454
458
|
# @param name [String] the name of the topic.
|
455
459
|
# @param num_partitions [Integer] the number of partitions that should be created
|
456
460
|
# in the topic.
|
457
461
|
# @param replication_factor [Integer] the replication factor of the topic.
|
458
462
|
# @param timeout [Integer] a duration of time to wait for the topic to be
|
459
463
|
# completely created.
|
464
|
+
# @param config [Hash] topic configuration entries. See
|
465
|
+
# [the Kafka documentation](https://kafka.apache.org/documentation/#topicconfigs)
|
466
|
+
# for more information.
|
460
467
|
# @raise [Kafka::TopicAlreadyExists] if the topic already exists.
|
461
468
|
# @return [nil]
|
462
|
-
def create_topic(name, num_partitions: 1, replication_factor: 1, timeout: 30)
|
463
|
-
@cluster.create_topic(
|
469
|
+
def create_topic(name, num_partitions: 1, replication_factor: 1, timeout: 30, config: {})
|
470
|
+
@cluster.create_topic(
|
471
|
+
name,
|
472
|
+
num_partitions: num_partitions,
|
473
|
+
replication_factor: replication_factor,
|
474
|
+
timeout: timeout,
|
475
|
+
config: config,
|
476
|
+
)
|
464
477
|
end
|
465
478
|
|
466
479
|
# Delete a topic in the cluster.
|
data/lib/kafka/cluster.rb
CHANGED
@@ -156,12 +156,13 @@ module Kafka
|
|
156
156
|
raise
|
157
157
|
end
|
158
158
|
|
159
|
-
def create_topic(name, num_partitions:, replication_factor:, timeout:)
|
159
|
+
def create_topic(name, num_partitions:, replication_factor:, timeout:, config:)
|
160
160
|
options = {
|
161
161
|
topics: {
|
162
162
|
name => {
|
163
163
|
num_partitions: num_partitions,
|
164
164
|
replication_factor: replication_factor,
|
165
|
+
config: config,
|
165
166
|
}
|
166
167
|
},
|
167
168
|
timeout: timeout,
|
@@ -28,7 +28,10 @@ module Kafka
|
|
28
28
|
encoder.write_array([])
|
29
29
|
|
30
30
|
# Config entries. We don't care.
|
31
|
-
encoder.write_array(
|
31
|
+
encoder.write_array(config.fetch(:config)) do |config_name, config_value|
|
32
|
+
encoder.write_string(config_name)
|
33
|
+
encoder.write_string(config_value)
|
34
|
+
end
|
32
35
|
end
|
33
36
|
|
34
37
|
# Timeout is in ms.
|
data/lib/kafka/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.4.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schierbeck
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -402,12 +402,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
402
402
|
version: 2.1.0
|
403
403
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
404
404
|
requirements:
|
405
|
-
- - "
|
405
|
+
- - ">"
|
406
406
|
- !ruby/object:Gem::Version
|
407
|
-
version:
|
407
|
+
version: 1.3.1
|
408
408
|
requirements: []
|
409
409
|
rubyforge_project:
|
410
|
-
rubygems_version: 2.6
|
410
|
+
rubygems_version: 2.7.6
|
411
411
|
signing_key:
|
412
412
|
specification_version: 4
|
413
413
|
summary: A client library for the Kafka distributed commit log.
|