Re: Updating external service and then processing response
Posted by
wazza on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Updating-external-service-and-then-processing-response-tp19851p19861.html
Hi Michael,
Yeah, I feel the updating of state in an external system is a job for a sink. However, I don't really like the idea of combining both a web service call and DB write in the one sink class because it's breaking single responsibility - I feel there should be a nicer way to compose these types of flows. Also means I need to write smarts/manage state in the sink because of several points of failure (web service call, db update). NB: the response from the web service is not just for control because there are some values I need to record, including a correlation key for when the external system sends notifications to us sometime in the following hours/days, and I then need to perform an update in our system.
Which is what led me to just thinking of the web service call as a map transform, and connecting a DB sink to that operator. However, as you mention, this will be a map/transform function with side effects, therefore I would need to manage state to ensure duplicate web service calls aren't sent on failure restarts etc.
Maybe I am missing a better approach, but for now I am leaning towards doing the web service call in a
(stateful)
map function, with the result feeding into a DB sink.
Cheers