Class MultipleIdsMessageAcknowledgingSourceBase<Type,UId,SessionId>
- java.lang.Object
-
- org.apache.flink.api.common.functions.AbstractRichFunction
-
- org.apache.flink.streaming.api.functions.source.RichSourceFunction<Type>
-
- org.apache.flink.streaming.api.functions.source.MessageAcknowledgingSourceBase<Type,UId>
-
- org.apache.flink.streaming.api.functions.source.MultipleIdsMessageAcknowledgingSourceBase<Type,UId,SessionId>
-
- Type Parameters:
Type- The type of the messages created by the source.UId- The type of the unique IDs which are consistent across sessions.SessionId- The type of the IDs that are used for acknowledging elements (ids valid during session).
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.functions.Function,org.apache.flink.api.common.functions.RichFunction,org.apache.flink.api.common.state.CheckpointListener,CheckpointedFunction,SourceFunction<Type>
@Deprecated @PublicEvolving public abstract class MultipleIdsMessageAcknowledgingSourceBase<Type,UId,SessionId> extends MessageAcknowledgingSourceBase<Type,UId>
Deprecated.This class is based on theSourceFunctionAPI, which is due to be removed. Use the newSourceAPI instead.Abstract base class for data sources that receive elements from a message queue and acknowledge them back by IDs. In contrast toMessageAcknowledgingSourceBase, this source handles two types of ids:- Session ids
- Unique message ids
Session ids are used to acknowledge messages in a session. When a checkpoint is restored, unacknowledged messages are redelivered. Duplicates are detected using the unique message ids which are checkpointed.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.functions.source.SourceFunction
SourceFunction.SourceContext<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected List<SessionId>sessionIdsDeprecated.protected Deque<org.apache.flink.api.java.tuple.Tuple2<Long,List<SessionId>>>sessionIdsPerSnapshotDeprecated.-
Fields inherited from class org.apache.flink.streaming.api.functions.source.MessageAcknowledgingSourceBase
pendingCheckpoints
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMultipleIdsMessageAcknowledgingSourceBase(Class<UId> idClass)Deprecated.Creates a new MessageAcknowledgingSourceBase for IDs of the given type.protectedMultipleIdsMessageAcknowledgingSourceBase(org.apache.flink.api.common.typeinfo.TypeInformation<UId> idTypeInfo)Deprecated.Creates a new MessageAcknowledgingSourceBase for IDs of the given type.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidacknowledgeIDs(long checkpointId, Set<UId> uniqueIds)Deprecated.Acknowledges the session ids.protected abstract voidacknowledgeSessionIDs(List<SessionId> sessionIds)Deprecated.Acknowledges the session ids.voidclose()Deprecated.voidopen(org.apache.flink.configuration.Configuration parameters)Deprecated.This method is deprecated since Flink 1.19.voidsnapshotState(org.apache.flink.runtime.state.FunctionSnapshotContext context)Deprecated.This method is called when a snapshot for a checkpoint is requested.-
Methods inherited from class org.apache.flink.streaming.api.functions.source.MessageAcknowledgingSourceBase
addId, initializeState, notifyCheckpointAborted, notifyCheckpointComplete
-
Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction
getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.streaming.api.functions.source.SourceFunction
cancel, run
-
-
-
-
Constructor Detail
-
MultipleIdsMessageAcknowledgingSourceBase
protected MultipleIdsMessageAcknowledgingSourceBase(Class<UId> idClass)
Deprecated.Creates a new MessageAcknowledgingSourceBase for IDs of the given type.- Parameters:
idClass- The class of the message ID type, used to create a serializer for the message IDs.
-
MultipleIdsMessageAcknowledgingSourceBase
protected MultipleIdsMessageAcknowledgingSourceBase(org.apache.flink.api.common.typeinfo.TypeInformation<UId> idTypeInfo)
Deprecated.Creates a new MessageAcknowledgingSourceBase for IDs of the given type.- Parameters:
idTypeInfo- The type information of the message ID type, used to create a serializer for the message IDs.
-
-
Method Detail
-
open
@Deprecated public void open(org.apache.flink.configuration.Configuration parameters) throws Exception
Deprecated.This method is deprecated since Flink 1.19. The users are recommended to implementopen(OpenContext openContext)and overrideopen(Configuration parameters)with an empty body instead. 1. If you implementopen(OpenContext openContext), theopen(OpenContext openContext)will be invoked and theopen(Configuration parameters)won't be invoked. 2. If you don't implementopen(OpenContext openContext), theopen(Configuration parameters)will be invoked in the default implementation of theopen(OpenContext openContext).Initialization method for theMultipleIdsMessageAcknowledgingSourceBase.- Specified by:
openin interfaceorg.apache.flink.api.common.functions.RichFunction- Overrides:
openin classorg.apache.flink.api.common.functions.AbstractRichFunction- Parameters:
parameters- The configuration containing the parameters attached to the contract.- Throws:
Exception- if an error happens.- See Also:
- FLIP-344: Remove parameter in RichFunction#open
-
close
public void close() throws ExceptionDeprecated.- Specified by:
closein interfaceorg.apache.flink.api.common.functions.RichFunction- Overrides:
closein classMessageAcknowledgingSourceBase<Type,UId>- Throws:
Exception
-
acknowledgeIDs
protected final void acknowledgeIDs(long checkpointId, Set<UId> uniqueIds)Deprecated.Acknowledges the session ids.- Specified by:
acknowledgeIDsin classMessageAcknowledgingSourceBase<Type,UId>- Parameters:
checkpointId- The id of the current checkout to acknowledge ids for.uniqueIds- The checkpointed unique ids which are ignored here. They only serve as a means of de-duplicating messages when the acknowledgment after a checkpoint fails.
-
acknowledgeSessionIDs
protected abstract void acknowledgeSessionIDs(List<SessionId> sessionIds)
Deprecated.Acknowledges the session ids.- Parameters:
sessionIds- The message ids for this session.
-
snapshotState
public void snapshotState(org.apache.flink.runtime.state.FunctionSnapshotContext context) throws ExceptionDeprecated.Description copied from interface:CheckpointedFunctionThis method is called when a snapshot for a checkpoint is requested. This acts as a hook to the function to ensure that all state is exposed by means previously offered throughFunctionInitializationContextwhen the Function was initialized, or offered now byFunctionSnapshotContextitself.- Specified by:
snapshotStatein interfaceCheckpointedFunction- Overrides:
snapshotStatein classMessageAcknowledgingSourceBase<Type,UId>- Parameters:
context- the context for drawing a snapshot of the operator- Throws:
Exception- Thrown, if state could not be created ot restored.
-
-