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
ConstructorDescriptionKafkaAckCallback
(KafkaMessageSource.KafkaAckInfo<K, V> ackInfo, org.springframework.kafka.listener.ConsumerProperties consumerProperties) Construct an instance with the provided properties. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Acknowledge the message delivery.void
Acknowledge the message.boolean
Implementations must implement this to indicate when the ack has been processed by the user so that the framework can auto-ack if needed.boolean
Return true if this acknowledgment supports auto ack when it has not been already ack'd by the application.void
Disable auto acknowledgment by aSourcePollingChannelAdapter
orMessageSourcePollingTemplate
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.kafka.support.Acknowledgment
acknowledge, nack, nack
-
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:AcknowledgmentCallback
Acknowledge the message.- Specified by:
acknowledge
in interfaceAcknowledgmentCallback
- Parameters:
status
- the status.
-
isAcknowledged
public boolean isAcknowledged()Description copied from interface:AcknowledgmentCallback
Implementations 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:
isAcknowledged
in interfaceAcknowledgmentCallback
- Returns:
- true if the message is already acknowledged.
-
acknowledge
public void acknowledge()Description copied from interface:SimpleAcknowledgment
Acknowledge the message delivery.- Specified by:
acknowledge
in interfaceorg.springframework.kafka.support.Acknowledgment
- Specified by:
acknowledge
in interfaceAcknowledgmentCallback
- Specified by:
acknowledge
in interfaceSimpleAcknowledgment
-
noAutoAck
public void noAutoAck()Description copied from interface:AcknowledgmentCallback
Disable auto acknowledgment by aSourcePollingChannelAdapter
orMessageSourcePollingTemplate
. Not all implementations support this - for example, the Kafka message source.- Specified by:
noAutoAck
in interfaceAcknowledgmentCallback
-
isAutoAck
public boolean isAutoAck()Description copied from interface:AcknowledgmentCallback
Return true if this acknowledgment supports auto ack when it has not been already ack'd by the application.- Specified by:
isAutoAck
in interfaceAcknowledgmentCallback
- Returns:
- true if auto ack is supported.
-