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

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

问题描述

螺栓是否可以从不同的喷口/螺栓接收多个输入元组?
例如,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 将接受来自两者的元组c $ c>单词和 exclaim1 ,均使用随机播放分组。

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

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

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