Class KafkaListenerException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.micronaut.messaging.exceptions.MessagingException
io.micronaut.messaging.exceptions.MessageListenerException
io.micronaut.configuration.kafka.exceptions.KafkaListenerException
All Implemented Interfaces:
Serializable

public class KafkaListenerException extends io.micronaut.messaging.exceptions.MessageListenerException
Exception thrown when an error occurs processing a ConsumerRecord via a KafkaListener.
Since:
1.0
Author:
Graeme Rocher
See Also:
  • Constructor Details

    • KafkaListenerException

      public KafkaListenerException(String message, Object listener, Consumer<?,?> kafkaConsumer, ConsumerRecord<?,?> consumerRecord)
      Creates a new exception.
      Parameters:
      message - The message
      listener - The listener
      kafkaConsumer - The consumer
      consumerRecord - The consumer record
    • KafkaListenerException

      public KafkaListenerException(String message, Throwable cause, Object listener, Consumer<?,?> kafkaConsumer, ConsumerRecord<?,?> consumerRecord)
      Creates a new exception.
      Parameters:
      message - The message
      cause - The cause
      listener - The listener
      kafkaConsumer - The consumer
      consumerRecord - The consumer record
    • KafkaListenerException

      public KafkaListenerException(Throwable cause, Object listener, Consumer<?,?> kafkaConsumer, ConsumerRecord<?,?> consumerRecord)
      Creates a new exception.
      Parameters:
      cause - The cause
      listener - The listener
      kafkaConsumer - The consumer
      consumerRecord - The consumer record
    • KafkaListenerException

      public KafkaListenerException(String message, Throwable cause, Object listener, Consumer<?,?> kafkaConsumer, @Nullable @Nullable ConsumerRecords<?,?> consumerRecords, @Nullable @Nullable ConsumerRecord<?,?> consumerRecord)
      Creates a new exception.
      Parameters:
      message - The message
      cause - The cause
      listener - The listener
      kafkaConsumer - The consumer
      consumerRecords - The batch of consumer records
      consumerRecord - The consumer record
  • Method Details

    • getKafkaListener

      public Object getKafkaListener()
      Returns:
      The bean that is the kafka listener
    • getKafkaConsumer

      public Consumer<?,?> getKafkaConsumer()
      Returns:
      The consumer that produced the error
    • getConsumerRecord

      public Optional<ConsumerRecord<?,?>> getConsumerRecord()
      Returns:
      The consumer record that was being processed that caused the error
    • getConsumerRecords

      public Optional<ConsumerRecords<?,?>> getConsumerRecords()
      Returns:
      The batch of consumer records that was being processed that caused the error
      Since:
      5.3