There is no such thing...
As a workaround, you can deactivate
the topology before killing it. This ensures, that Spout.deactivate()
is called.
If you need to call a method at bolts, use Spout.deactivate()
to sent a "notification tuple" (that does not contain data to be processed) through the whole topology. And in each bolt, call your special method if a "notification tuple" is received.
Furthermore, this "notification tuple" must be forwarded by the bolt to all its predecessors. You need to make sure, that the "notification tuples" is sent to all parallel executors of each bolt. For this, use a dedicated "notification stream" and subscribe each bolt via allGrouping()
to this steam (in addition to the regular input streams). Within each bolt, you need to check if the tuple is a notification tuple or not (for example via Tuple.getSourceStreamId()
)
After clean up is finished, you can kill the topology finally.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…