Skip to content

How to configure errorHandler when using @RetryableTopic #1863

@TheLeftHandOfGod

Description

@TheLeftHandOfGod

When I use @RetryableTopic, the errorHandler configuration of @KafkaListener does not take effect and is replaced with SeekToCurrentErrorHandler, I want to print the error stack trace. How should I configure?

@RetryableTopic(
        attempts = "2",
        backoff = @Backoff(delay = 1000L, multiplier = 2.0),
        topicSuffixingStrategy = TopicSuffixingStrategy.SUFFIX_WITH_INDEX_VALUE,
        fixedDelayTopicStrategy = FixedDelayStrategy.SINGLE_TOPIC,
        listenerContainerFactory = "retryKafkaListenerContainerFactory"
)
@KafkaListener(
        topics = TOPIC_ENTERPRISE,
        clientIdPrefix = "enterprise",
        containerFactory = "kafkaListenerContainerFactory",
        errorHandler = "customKafkaListenerErrorHandler"
)
public void enterpriseConsumer(ConsumerRecord<Long, String> record) {
    LOGGER.info("{} - topoc:{}, part: {}, offset: {}, key: {}, value: {}", Thread.currentThread().getName(), record.topic(), record.partition(), record.offset(), record.key(), record.value());
    int i = 1 / 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions