You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by Marc Roos <M....@f1-outsourcing.eu> on 2015/08/31 09:20:13 UTC

Average bolt

I would like to calculate an average of some sensors. The sensors are 
not emitting at the same time and also don’t have a constant stream.
I guess I have to create the 'average bolt' that waits until data is 
received from all spouts (within a specific time), but where do I find 
what spouts are connect to this bolt? Or is there a better way of doing 
this?



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -. 
F1 Outsourcing Development Sp. z o.o.
Poland 

t:  +48 (0)124466845
f:  +48 (0)124466843
e:  marc@f1-outsourcing.eu



Re: Average bolt

Posted by "Matthias J. Sax" <mj...@informatik.hu-berlin.de>.
You have two options to determine your producers:

 1) each incoming tuples contains meta data you can access. For example:
Tuple.getSourceComponent(). See
https://storm.apache.org/javadoc/apidocs/backtype/storm/tuple/Tuple.html

 2) in Bolt.prepare(...) one parameter is a TopologyContext object. This
object contains all information about the whole topology (ie, all
spouts/bolts, parallelism, declared streams, connections)

-Matthias

On 08/31/2015 09:20 AM, Marc Roos wrote:
> 
> I would like to calculate an average of some sensors. The sensors are 
> not emitting at the same time and also don’t have a constant stream.
> I guess I have to create the 'average bolt' that waits until data is 
> received from all spouts (within a specific time), but where do I find 
> what spouts are connect to this bolt? Or is there a better way of doing 
> this?
> 
> 
> 
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -. 
> F1 Outsourcing Development Sp. z o.o.
> Poland 
> 
> t:  +48 (0)124466845
> f:  +48 (0)124466843
> e:  marc@f1-outsourcing.eu
> 
> 
>