Class DefaultCheckpointMetadata<T>
java.lang.Object
io.smallrye.reactive.messaging.kafka.commit.DefaultCheckpointMetadata<T>
- Type Parameters:
T- type of the processing state
- All Implemented Interfaces:
CheckpointMetadata<T>
Default implementation of
CheckpointMetadata-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCheckpointMetadata(org.apache.kafka.common.TopicPartition topicPartition, long recordOffset, KafkaCheckpointCommit.CheckpointState<T> checkpointState) -
Method Summary
Modifier and TypeMethodDescriptionstatic <S> DefaultCheckpointMetadata<S> fromMessage(org.eclipse.microprofile.reactive.messaging.Message<?> message) getNext()longorg.apache.kafka.common.TopicPartitionbooleanSet the next processing state to the given state, associated with the current record offset + 1.Set the next processing state to the given state, associated with the current record offset + 1.SeeCheckpointMetadata.transform(Supplier, Function, boolean)The state will not be persisted on message acknowledgement.Apply the transformation to the current state, if a previous state doesn't exist, start the transformation from the supplied initial state.SeeCheckpointMetadata.transform(Supplier, Function, boolean)The state will not be persisted on message acknowledgement.
-
Constructor Details
-
DefaultCheckpointMetadata
public DefaultCheckpointMetadata(org.apache.kafka.common.TopicPartition topicPartition, long recordOffset, KafkaCheckpointCommit.CheckpointState<T> checkpointState)
-
-
Method Details
-
fromMessage
public static <S> DefaultCheckpointMetadata<S> fromMessage(org.eclipse.microprofile.reactive.messaging.Message<?> message) -
getTopicPartition
public org.apache.kafka.common.TopicPartition getTopicPartition()- Specified by:
getTopicPartitionin interfaceCheckpointMetadata<T>- Returns:
- the topic-partition of this record
-
getRecordOffset
public long getRecordOffset()- Specified by:
getRecordOffsetin interfaceCheckpointMetadata<T>- Returns:
- the offset of this record
-
isPersistOnAck
public boolean isPersistOnAck()- Specified by:
isPersistOnAckin interfaceCheckpointMetadata<T>- Returns:
trueif the processing state will be persisted on message acknowledgement
-
getCurrent
- Specified by:
getCurrentin interfaceCheckpointMetadata<T>- Returns:
- the current processing state
-
getNext
- Specified by:
getNextin interfaceCheckpointMetadata<T>- Returns:
- the next processing state set during this processing
-
setNext
Description copied from interface:CheckpointMetadataSet the next processing state to the given state, associated with the current record offset + 1.- Specified by:
setNextin interfaceCheckpointMetadata<T>- Parameters:
state- the next statepersistOnAck- Iftruethen the state will be persisted on message acknowledgement- Returns:
- the previous state
-
setNext
Description copied from interface:CheckpointMetadataSet the next processing state to the given state, associated with the current record offset + 1. The state will not be persisted on message acknowledgement.- Specified by:
setNextin interfaceCheckpointMetadata<T>- Parameters:
state- the next state- Returns:
- the previous state
-
transform
public T transform(Supplier<T> initialStateSupplier, Function<T, T> transformation, boolean persistOnAck) Description copied from interface:CheckpointMetadataApply the transformation to the current state, if a previous state doesn't exist, start the transformation from the supplied initial state. The state will be associated with the current record offset + 1.- Specified by:
transformin interfaceCheckpointMetadata<T>- Parameters:
initialStateSupplier- if no previous state does exist, start the transformation from this state.transformation- the transformation functionpersistOnAck- Iftruethen the state will be persisted on message acknowledgement- Returns:
- the previous state
-
transform
Description copied from interface:CheckpointMetadata- Specified by:
transformin interfaceCheckpointMetadata<T>- Parameters:
initialState- if no previous state does exist, start the transformation from this state.transformation- the transformation functionpersistOnAck- Iftruethen the state will be persisted on message acknowledgement- Returns:
- the previous state
-
transform
Description copied from interface:CheckpointMetadataSeeCheckpointMetadata.transform(Supplier, Function, boolean)The state will not be persisted on message acknowledgement.- Specified by:
transformin interfaceCheckpointMetadata<T>- Parameters:
initialStateSupplier- if no previous state does exist, start the transformation from this state.transformation- the transformation function- Returns:
- the previous state
-
transform
Description copied from interface:CheckpointMetadataSeeCheckpointMetadata.transform(Supplier, Function, boolean)The state will not be persisted on message acknowledgement.- Specified by:
transformin interfaceCheckpointMetadata<T>- Parameters:
initialState- if no previous state does exist, start the transformation from this state.transformation- the transformation function- Returns:
- the previous state
-