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:
java.io.Serializable
public class BatchListenerFailedException extends KafkaException
An exception thrown by user code to inform the framework which record in a batch has failed.- Since:
- 2.5
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.springframework.kafka.KafkaException
KafkaException.Level
-
-
Constructor Summary
Constructors Constructor Description BatchListenerFailedException(java.lang.String message, int index)
Construct an instance with the provided properties.BatchListenerFailedException(java.lang.String message, java.lang.Throwable cause, int index)
Construct an instance with the provided properties.BatchListenerFailedException(java.lang.String message, java.lang.Throwable cause, org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record)
Construct an instance with the provided properties.BatchListenerFailedException(java.lang.String message, org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record)
Construct an instance with the provided properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getIndex()
Return the index in the batch of the failed record.java.lang.String
getMessage()
org.apache.kafka.clients.consumer.ConsumerRecord<?,?>
getRecord()
Return the failed record.-
Methods inherited from class org.springframework.kafka.KafkaException
selfLog
-
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMostSpecificCause, getRootCause
-
-
-
-
Constructor Detail
-
BatchListenerFailedException
public BatchListenerFailedException(java.lang.String message, int index)
Construct an instance with the provided properties.- Parameters:
message
- the message.index
- the index in the batch of the failed record.
-
BatchListenerFailedException
public BatchListenerFailedException(java.lang.String message, @Nullable java.lang.Throwable cause, int index)
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(java.lang.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(java.lang.String message, @Nullable java.lang.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 Detail
-
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
public java.lang.String getMessage()
- Overrides:
getMessage
in classorg.springframework.core.NestedRuntimeException
-
-