Skip to content

RetryTopicConfigurationBuilder#includeTopic does not work with SPEL topics #1916

@celcius112

Description

@celcius112

When manually defining a bean RetryTopicConfiguration with an includeTopic, such as:

  @KafkaListener(topics = "${kafka.topic}", groupId = "id")
  public void listen(String message) {

  }

  @Bean
  public RetryTopicConfiguration retryTopicConfiguration(KafkaTemplate<String, String> template) {
    return RetryTopicConfigurationBuilder.newInstance()
        .includeTopic("topic")
        .create(template);
  }

where kafka.topic is a SPEL expression that resolves to topic, reply and dead letter topics are not automatically created as they are not matched in AllowDenyCollectionManager.

Diving a bit into the implementation, AllowDenyCollectionManager#areAllowed will try to match the includeTopic with the non-resolved SPEL expression ${kafka.topic}.

Here's a sample application. By launching the tests or the application without .includeTopic("topic") we see in the logs that the retry and dead letter topics are created, but adding .includeTopic("topic") the logs are not shown.
demo 2.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions