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()
long
org.apache.kafka.common.TopicPartition
boolean
Set 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:
getTopicPartition
in interfaceCheckpointMetadata<T>
- Returns:
- the topic-partition of this record
-
getRecordOffset
public long getRecordOffset()- Specified by:
getRecordOffset
in interfaceCheckpointMetadata<T>
- Returns:
- the offset of this record
-
isPersistOnAck
public boolean isPersistOnAck()- Specified by:
isPersistOnAck
in interfaceCheckpointMetadata<T>
- Returns:
true
if the processing state will be persisted on message acknowledgement
-
getCurrent
- Specified by:
getCurrent
in interfaceCheckpointMetadata<T>
- Returns:
- the current processing state
-
getNext
- Specified by:
getNext
in interfaceCheckpointMetadata<T>
- Returns:
- the next processing state set during this processing
-
setNext
Description copied from interface:CheckpointMetadata
Set the next processing state to the given state, associated with the current record offset + 1.- Specified by:
setNext
in interfaceCheckpointMetadata<T>
- Parameters:
state
- the next statepersistOnAck
- Iftrue
then the state will be persisted on message acknowledgement- Returns:
- the previous state
-
setNext
Description copied from interface:CheckpointMetadata
Set 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:
setNext
in 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:CheckpointMetadata
Apply 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:
transform
in interfaceCheckpointMetadata<T>
- Parameters:
initialStateSupplier
- if no previous state does exist, start the transformation from this state.transformation
- the transformation functionpersistOnAck
- Iftrue
then the state will be persisted on message acknowledgement- Returns:
- the previous state
-
transform
Description copied from interface:CheckpointMetadata
- Specified by:
transform
in interfaceCheckpointMetadata<T>
- Parameters:
initialState
- if no previous state does exist, start the transformation from this state.transformation
- the transformation functionpersistOnAck
- Iftrue
then the state will be persisted on message acknowledgement- Returns:
- the previous state
-
transform
Description copied from interface:CheckpointMetadata
SeeCheckpointMetadata.transform(Supplier, Function, boolean)
The state will not be persisted on message acknowledgement.- Specified by:
transform
in 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:CheckpointMetadata
SeeCheckpointMetadata.transform(Supplier, Function, boolean)
The state will not be persisted on message acknowledgement.- Specified by:
transform
in interfaceCheckpointMetadata<T>
- Parameters:
initialState
- if no previous state does exist, start the transformation from this state.transformation
- the transformation function- Returns:
- the previous state
-