我正在使用正在从RabbitMQ队列中读取的风暴喷口。我从命令提示符向集群提交Storm拓扑(使用StormSubmitter)。因此,在运行拓扑时,它应该等待spout从队列中读取数据,但它没有这样做。
是因为拓扑无法在运行时读取数据吗?
我正在运行拓扑: TopologyBuilder builder = new TopologyBuilder(); builder.setSpout(" rabbitmqspout",new RabbitmqSpout()); builder.setBolt(" rabbitmqbolt",new RabbitmqBolt()) .shuffleGrouping(" rabbitmqspout&#34); Config conf = new Config();
conf.put(Config.TOPOLOGY_WORKERS, 4);
conf.put(Config.TOPOLOGY_DEBUG, true);
try {
System.out.println("TOPOLOGY submitted");
StormSubmitter.submitTopology("rabbittest3", conf, builder.createTopology());
}
spout正在从rabbitmq队列中读取:
public void nextTuple()
{
try
{
consumer = new QueueingConsumer(channel);
channel.basicConsume(QUEUE_NAME, true, consumer);
while(true){
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
String message = new String(delivery.getBody());
collector.emit(new Values(new String(message)));
}
}