Apache Storm bolt 从不同的 spout/bolt 接收多个输入元组 [英] An Apache Storm bolt receive multiple input tuples from different spout/bolt

查看:33
本文介绍了Apache Storm bolt 从不同的 spout/bolt 接收多个输入元组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个 bolt 是否可以从不同的 spout/bolt 接收多个输入元组?例如,Bolt C 接收来自 Spout A 的输入元组和来自 Bolt B 的输入元组进行处理.我应该如何实施它?我的意思是为 Bolt C 及其拓扑编写 Java 代码.

Is it possible for a bolt receive multiple input tuples from different spout/bolt? For instance, Bolt C receive input tuples from Spout A and input tuples from Bolt B to be processed. How should I implement it? I mean writing the Java code for Bolt C and also its topology.

推荐答案

教程回答您的问题.

https://storm.apache.org/documentation/Tutorial.html

这是您目标的代码(来自教程的 C/P):

Here is the code for your goal(C/P from tutorial):

builder.setBolt("exclaim2", new ExclamationBolt(), 5)
            .shuffleGrouping("words")
            .shuffleGrouping("exclaim1");

exclaim2 将接受来自 wordsexclaim1 的元组,两者都使用随机分组.

exclaim2 will accept tuples from both words and exclaim1, both using shuffle grouping.

这篇关于Apache Storm bolt 从不同的 spout/bolt 接收多个输入元组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆