Skip to content

Adding new KafkaListenerEndpointRegistry.getListenerContainersMatchingId(predicate: Predicate<String>) #3135

@JooHyukKim

Description

@JooHyukKim

Expected Behavior
Would be nice to have method...

kafkaListenerEndpointRegistry
            .getListenerContainersMatchingId( id -> id.startsWith(prefix))
           .forEach(MessageListenerContainer::start)
           

Current Behavior

kafkaListenerEndpointRegistry
            .getListenerContainerIds()
            .filter( id -> id.startsWith(prefix))
            .forEach(id -> kafkaListenerEndpointRegistry.getListenerContainer(id).start())

Context

I run application that starts/stops listeners at certain time(office hours)

We have listeners with ids such as...

  • listener_product_purchase
  • listener_product_purchase-retry-0
  • listener_product_purchase-retry-1
  • listener_product_purchase-dlt

... this, generated by @RetryableTopic configuration where I need to filter topics by some pattern and start/stop them.
Current implementation feels awkward to do iterate either nested/double.

Would be syntactic sugar.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions