You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Udo Fholl <ud...@gmail.com> on 2016/01/29 19:40:05 UTC

mapWithState: multiple operations on the same stream

Hi,

I have a stream which I need to process events and send them to another
service and then remove the key from the state. I'm storing state because I
some events are delayed.

My current approach is to consolidate the state, store it with a
mapWithState invocation. Then rather than using a foreachRDD to send it I
use a transform invocation. I do that in order to mark the event as failed
or successfully sent. The service that I'm sending data to, is quite faulty.

What would be the best approach for this workflow:
* Obtain data
* Consolidate state
* Try to send
* If it succeeds remove from state otherwise keep it in the state

Thanks.

Best regards,
Udo.