I'm trying to connect a KafkaSpout belonging to a storm topology running on a LocalCluster
object. I wrote this code according to the documentation I found on https://github.com/apache/storm/tree/master/external/storm-kafka.
private static final String brokerZkStr = "localhost:2181";
private static final String topic = "/test-topic-multi";
public void startTopology()
{
BrokerHosts hosts = new ZkHosts(brokerZkStr);
SpoutConfig conf = new SpoutConfig(hosts, topic, "localhost:2181", UUID
.randomUUID().toString());
KafkaSpout kafkaSput = new KafkaSpout(conf);
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("kafka-spout", kafkaSput);
Config topConfig = new Config();
topConfig.setDebug(true);
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("HelloStorm", topConfig , builder.createTopology());
}
I want to use a zookeeper instance running at localhost:2181
but when a try to run the code I get the following error:
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Invalid path string "/brokers/topics//test-topic-multi/partitions" caused by empty node name specified @16
at storm.kafka.DynamicBrokersReader.getBrokerInfo(DynamicBrokersReader.java:81)
at storm.kafka.trident.ZkBrokerReader.<init>(ZkBrokerReader.java:42)
at storm.kafka.KafkaUtils.makeBrokerReader(KafkaUtils.java:57)
at storm.kafka.KafkaSpout.open(KafkaSpout.java:87)
It seems to be just a problem of wrong settings but I can't solve it
PS Kafka configuration is the following: 1 instance of Zookeeper and 2 brokers running on localhost:9092
and localhost:9093
Your kafka topic name is not valid. Why are you attempting to connect to a topic which does not exist?
Are you really sure the front-slash belongs to the topic name?