Class AcknowledgeOnCheckpoint<ACKID extends Serializable>

  • Type Parameters:
    ACKID - Type of Ids to acknowledge
    All Implemented Interfaces:
    org.apache.flink.api.common.state.CheckpointListener, org.apache.flink.streaming.api.checkpoint.ListCheckpointed<AcknowledgeIdsForCheckpoint<ACKID>>

    public class AcknowledgeOnCheckpoint<ACKID extends Serializable>
    extends Object
    implements org.apache.flink.api.common.state.CheckpointListener, org.apache.flink.streaming.api.checkpoint.ListCheckpointed<AcknowledgeIdsForCheckpoint<ACKID>>
    Helper class for SourceFunctions to acknowledge messages to external systems after a successful checkpoint.

    The mechanism for this source assumes that messages are identified by a unique ID. When messages are taken from the message queue, the message must not be dropped immediately from the external system, but must be retained until acknowledged. Messages that are not acknowledged within a certain time interval will be served again (to a different connection, established by the recovered source).

    Note that this source can give no guarantees about message order in the case of failures, because messages that were retrieved but not yet acknowledged will be returned later again, after a set of messages that was not retrieved before the failure.

    Internally, this class gathers the IDs of elements it emits. Per checkpoint, the IDs are stored and acknowledged when the checkpoint is complete. That way, no message is acknowledged unless it is certain that it has been successfully processed throughout the topology and the updates to any state caused by that message are persistent.

    • Constructor Detail

      • AcknowledgeOnCheckpoint

        public AcknowledgeOnCheckpoint​(Acknowledger<ACKID> acknowledger)
    • Method Detail

      • addAcknowledgeId

        public void addAcknowledgeId​(ACKID id)
      • notifyCheckpointComplete

        public void notifyCheckpointComplete​(long checkpointId)
        Specified by:
        notifyCheckpointComplete in interface org.apache.flink.api.common.state.CheckpointListener
      • notifyCheckpointAborted

        public void notifyCheckpointAborted​(long checkpointId)
        Specified by:
        notifyCheckpointAborted in interface org.apache.flink.api.common.state.CheckpointListener
      • numberOfOutstandingAcknowledgements

        public int numberOfOutstandingAcknowledgements()