Do - Tuple.getSourceComponent(), - Tuple.getSourceTask(), - Tuple.getSourceStreamId()
do the trick? http://storm.incubator.apache.org/apidocs/backtype/storm/tuple/Tuple.html#getSourceComponent() I would send the model on a different stream. On Mon, Feb 24, 2014 at 8:13 AM, Klausen Schaefersinho < [email protected]> wrote: > Hi, > > I have a topology which process events and aggregates them in some form > and performs some prediction based on a machine learning (ML) model. Every > x events the one of the bolt involved in the normal processing emit an > "trainModel" event, which is routed to a bolt which is just dedicated to > the training. One the training is done, the new model should be send back > to the prediction bolt. The topology looks like: > > > InputSpout -> AggregationBolt -> PredictionBolt -> OutputBolt > | /\ > \/ | > TrainingBolt -------------+ > > > > This works all fine, but I am now not sure how I can get the model back. > > My first idea was to connect the normal prediction bolt to the training > bolt, but this does not work, because the input tuple can have ether events > or a model. So I write something like : > > input.getBinaryByField("model"); > > An exception is thrown if the bolt was triggered by an event. Is there way > to distinguish from which bolt / stream the current bolt was triggered? > > > Cheers, > > Klaus > >
