When is the 'ack' method in the spout called in Apache Storm?

223 views Asked by At

I have a topology for processing documents with two bolts. I need to be able to make modifications a data structure stored in the spout after a document is fully processed/has made its way through the whole topology. Before learning more about Apache Storm, I believe that the 'ack' method that is implemented in the spout was only called at the end of the topology. I see now that 'ack' needs to be called in every bolt and am confused.

Essentially, if I put custom code in the 'ack' method in the spout: when would it be executed? Everytime the 'ack' method is called in a bolt or when the entirety of a tuple tree has been acked/once per tuple emitted per spout?

1

There are 1 answers

0
Tyreal On BEST ANSWER

The ack method in the spout is only called once the tuple has been acked by all bolts downstream, not before. See here. That means that your code would be executed at the time the tuple has been acked in the entirety of the tuple tree.