Class BatchListenerFailedException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.core.NestedRuntimeException
org.springframework.kafka.KafkaException
org.springframework.kafka.listener.BatchListenerFailedException
- All Implemented Interfaces:
Serializable
An exception thrown by user code to inform the framework which record in a batch has
failed.
- Since:
- 2.5
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.kafka.KafkaException
KafkaException.Level
-
Constructor Summary
ConstructorDescriptionBatchListenerFailedException
(String message, int index) Construct an instance with the provided properties.BatchListenerFailedException
(String message, Throwable cause, int index) Construct an instance with the provided properties.BatchListenerFailedException
(String message, Throwable cause, org.apache.kafka.clients.consumer.ConsumerRecord<?, ?> record) Construct an instance with the provided properties.BatchListenerFailedException
(String message, org.apache.kafka.clients.consumer.ConsumerRecord<?, ?> record) Construct an instance with the provided properties. -
Method Summary
Modifier and TypeMethodDescriptionint
getIndex()
Return the index in the batch of the failed record.org.apache.kafka.clients.consumer.ConsumerRecord<?,
?> Return the failed record.Methods inherited from class org.springframework.kafka.KafkaException
selfLog
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMostSpecificCause, getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
BatchListenerFailedException
Construct an instance with the provided properties.- Parameters:
message
- the message.index
- the index in the batch of the failed record.
-
BatchListenerFailedException
Construct an instance with the provided properties.- Parameters:
message
- the message.cause
- the cause.index
- the index in the batch of the failed record.
-
BatchListenerFailedException
public BatchListenerFailedException(String message, org.apache.kafka.clients.consumer.ConsumerRecord<?, ?> record) Construct an instance with the provided properties.- Parameters:
message
- the message.record
- the failed record.
-
BatchListenerFailedException
public BatchListenerFailedException(String message, @Nullable Throwable cause, org.apache.kafka.clients.consumer.ConsumerRecord<?, ?> record) Construct an instance with the provided properties.- Parameters:
message
- the message.cause
- the cause.record
- the failed record.
-
-
Method Details
-
getRecord
@Nullable public org.apache.kafka.clients.consumer.ConsumerRecord<?,?> getRecord()Return the failed record.- Returns:
- the record.
-
getIndex
public int getIndex()Return the index in the batch of the failed record.- Returns:
- the index.
-
getMessage
- Overrides:
getMessage
in classThrowable
-