Module: Kafka::Utils
- Defined in:
- lib/ext/kafka.rb
Class Method Summary collapse
- .delete_topic(zk, topic) ⇒ Object
- .get_partitions_for_topic(zk, topic) ⇒ Object
- .new_zk_client(zk_connect, timeout = 30_000) ⇒ Object
Class Method Details
.delete_topic(zk, topic) ⇒ Object
75 76 77 78 |
# File 'lib/ext/kafka.rb', line 75 def self.delete_topic(zk, topic) acl = Kafka::Utils::ZkUtils::DefaultAcls(false) zk.create_persistent_path(ZkUtils.get_delete_topic_path(topic), '', acl) end |
.get_partitions_for_topic(zk, topic) ⇒ Object
69 70 71 72 73 |
# File 'lib/ext/kafka.rb', line 69 def self.get_partitions_for_topic(zk, topic) topics = Scala::Collection::Immutable::List.from_array([topic].to_java) partitions = zk.get_partitions_for_topics(topics) partitions.get(topic).get end |
.new_zk_client(zk_connect, timeout = 30_000) ⇒ Object
65 66 67 |
# File 'lib/ext/kafka.rb', line 65 def self.new_zk_client(zk_connect, timeout=30_000) ::ZkClient::ZkClient.new(zk_connect, timeout, timeout, ZKStringSerializer) end |