Module: Kafka::Utils

Defined in:
lib/ext/kafka.rb

Class Method Summary collapse

Class Method Details

.delete_topic(zk, topic) ⇒ Object



78
79
80
81
# File 'lib/ext/kafka.rb', line 78

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



72
73
74
75
76
# File 'lib/ext/kafka.rb', line 72

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



68
69
70
# File 'lib/ext/kafka.rb', line 68

def self.new_zk_client(zk_connect, timeout=30_000)
  ::ZkClient::ZkClient.new(zk_connect, timeout, timeout, ZKStringSerializer)
end