Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.bestmile
- package service
- import kafka.utils.ZkUtils
- import org.I0Itec.zkclient.{ZkClient, ZkConnection}
- class KafkaAdmin(zkClient: ZkClient) {
- def topics: Seq[String] = ZkUtils.getAllTopics(zkClient)
- def delete(topic: String): Unit = ZkUtils.createPersistentPath(zkClient, ZkUtils.getDeleteTopicPath(topic))
- }
- object KafkaAdmin {
- def fromConfig(implicit config: Config): KafkaAdmin = {
- import ConfigKeys._
- val addr = config(Zookeeper)
- new KafkaAdmin(new ZkClient(new ZkConnection(addr.getHostString + ":" + addr.getPort)))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement