Apache Storm没有收到来自kafka的消息

时间:2015-03-18 03:50:11

标签: java apache-kafka apache-storm

我正在尝试将Apache Storm与Kafka集成。连接似乎很好,但没有收到任何消息。但是这些消息似乎也被发送到Kafka服务器,而Kafka服务器中相应主题的索引文件显示了一些数据。有没有办法在Storm端调试更多..?我在Storm中使用客户解码器来获取消息。 Storm的实现是:

TopologyBuilder builder = new TopologyBuilder();
Broker brokerForPartition0 = new Broker("xxxxx");
GlobalPartitionInformation partitionInfo = new GlobalPartitionInformation();
partitionInfo.addPartition(0, brokerForPartition0);
StaticHosts hosts = new StaticHosts(partitionInfo);
SpoutConfig spoutConfig = new SpoutConfig(hosts, TOPIC, "/"+TOPIC, clientId);
spoutConfig.scheme = new MyLogScheme();
builder.setSpout("spout", new KafkaSpout(spoutConfig));
builder.setBolt("printer", new PrinterBolt());
Config conf = new Config();
conf.setDebug(true);
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("test", conf, builder.createTopology());

2 个答案:

答案 0 :(得分:1)

您正在使用自己的方案“MyLogScheme”。问题可能出在myLogScheme中。尝试使用StringScheme的默认方案。希望这会让你看到一些消息。

答案 1 :(得分:0)

检查主要Storm Topology中的主题名称。卡夫卡和风暴主题都是一样的。检查kafka主题中的经纪人