简体   繁体   English

在风暴中存储批处理的kafka消息需要一些例子

[英]store batched kafka messages in storm need some example

我尝试使用普通的消费者示例来检索消息。但是现在我的消费者是Storm,所以我需要将成批的kafka消息存储在Storm中需要一些示例。

I am using the storm-kafka spout. 我正在使用Storm-kafka喷嘴。 You can find several examples on their page. 您可以在他们的页面上找到几个示例。 I needed the KafkaSpout class in my application, but they seem to also support batches: 我的应用程序中需要KafkaSpout类,但它们似乎也支持批处理:

Fields fields = new Fields("key", "message");
FixedBatchSpout spout = new FixedBatchSpout(fields, 4,
            new Values("storm", "1"),
            new Values("trident", "1"),
            new Values("needs", "1"),
            new Values("javadoc", "1")
);
spout.setCycle(true);
builder.setSpout("spout", spout, 5);

Please narrow down the question if you need more specific examples. 如果您需要更多具体示例,请缩小问题范围。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM