Class KafkaMessageSource.KafkaAckCallback<K,V>
java.lang.Object
org.springframework.integration.kafka.inbound.KafkaMessageSource.KafkaAckCallback<K,V>
- Type Parameters:
K- the key type.V- the value type.
- All Implemented Interfaces:
AcknowledgmentCallback,SimpleAcknowledgment,org.springframework.kafka.support.Acknowledgment
- Enclosing class:
- KafkaMessageSource<K,V>
public static class KafkaMessageSource.KafkaAckCallback<K,V> extends Object implements AcknowledgmentCallback, org.springframework.kafka.support.Acknowledgment
AcknowledgmentCallback for Kafka.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.acks.AcknowledgmentCallback
AcknowledgmentCallback.Status -
Constructor Summary
Constructors Constructor Description KafkaAckCallback(KafkaMessageSource.KafkaAckInfo<K,V> ackInfo, org.springframework.kafka.listener.ConsumerProperties consumerProperties)Construct an instance with the provided properties. -
Method Summary
Modifier and Type Method Description voidacknowledge()Acknowledge the message delivery.voidacknowledge(AcknowledgmentCallback.Status status)Acknowledge the message.booleanisAcknowledged()Implementations must implement this to indicate when the ack has been processed by the user so that the framework can auto-ack if needed.booleanisAutoAck()Return true if this acknowledgment supports auto ack when it has not been already ack'd by the application.voidnoAutoAck()Disable auto acknowledgment by aSourcePollingChannelAdapterorMessageSourcePollingTemplate.
-
Constructor Details
-
KafkaAckCallback
public KafkaAckCallback(KafkaMessageSource.KafkaAckInfo<K,V> ackInfo, @Nullable org.springframework.kafka.listener.ConsumerProperties consumerProperties)Construct an instance with the provided properties.- Parameters:
ackInfo- the ack info.consumerProperties- the consumer properties - only commit-related properties are used.
-
-
Method Details
-
acknowledge
Description copied from interface:AcknowledgmentCallbackAcknowledge the message.- Specified by:
acknowledgein interfaceAcknowledgmentCallback- Parameters:
status- the status.
-
isAcknowledged
public boolean isAcknowledged()Description copied from interface:AcknowledgmentCallbackImplementations must implement this to indicate when the ack has been processed by the user so that the framework can auto-ack if needed.- Specified by:
isAcknowledgedin interfaceAcknowledgmentCallback- Returns:
- true if the message is already acknowledged.
-
acknowledge
public void acknowledge()Description copied from interface:SimpleAcknowledgmentAcknowledge the message delivery.- Specified by:
acknowledgein interfaceorg.springframework.kafka.support.Acknowledgment- Specified by:
acknowledgein interfaceAcknowledgmentCallback- Specified by:
acknowledgein interfaceSimpleAcknowledgment
-
noAutoAck
public void noAutoAck()Description copied from interface:AcknowledgmentCallbackDisable auto acknowledgment by aSourcePollingChannelAdapterorMessageSourcePollingTemplate. Not all implementations support this - for example, the Kafka message source.- Specified by:
noAutoAckin interfaceAcknowledgmentCallback
-
isAutoAck
public boolean isAutoAck()Description copied from interface:AcknowledgmentCallbackReturn true if this acknowledgment supports auto ack when it has not been already ack'd by the application.- Specified by:
isAutoAckin interfaceAcknowledgmentCallback- Returns:
- true if auto ack is supported.
-