You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by Gilles Roudiere <gi...@gmail.com> on 2019/01/07 13:11:38 UTC
How to get a stream out of the Trident StateUpdater collector ?
Hi everyone,
I have a question regarding the StateUpdater API. According to a book I
read, when the update function of the StateUpdater is called, a collector
is provided so that you can send tuples to a stream. This makes sense when
you see the updateState function:
> void updateState(S state, List<TridentTuple> tuples, TridentCollector
> collector);
>
I would like to use this feature, but I have not clue how to retrieve the
stream of those emitted tuples.
My main code is somehow like that:
> topology.newStream("json", jsonSpout)
> .partitionBy(new Fields("client_ip"))
> .partitionPersist(new MemoryMapState.Factory(), new
> MyStateUpdater());
>
This returns a TridentState object, which cannot be transform into a stream
(unless if you use the newValuesStream() function, but it does not look
like it is the function I am looking for. It is probably to retreive the
stream of newly updated values in the state, unless I am wrong).
The updateState function of MyStateUpdater only updates the state and tries
to send a new tuple via the provided collector when a condition in the
state is met.
I'd be very grateful to anyone who could help,
Thank you,
Regards,
Gilles Roudière