Skip to content

Can not register consumer customizer to only be used for PulsarListener #486

Closed
@onobc

Description

@onobc

Fact 1: When using Spring Boot auto configuration, all registered ConsumerBuilderCustomizer beans are used as default config customizers for the DefaultPulsarConsumerFactory.

Fact 2: The @PulsarListener allows a customizer bean to be applied to its underlying consumer via its consumerCustomizer attribute.

Outcome: A user is unable to register a customizer that is only used by a @PulsarListener and not as default configuration for the consumer factory.

Ask: We need a way to register a customizer and exclude it from factory default configuration.

Options

@Qualifer

Introduce a @Qualifer that can then be filtered out on the Boot side.

  • ✅ single customize API easier to maintain and reason with
  • ❌ Would require changes to Boot (would not happen in 3.2.0 as we are in RC phase)
  • ❌ Would require more complicated lookup code respecting the qualifier (like what is done for actuator groups)
  • ❌ User would need to know to qualify these vs the listener specific customizers

Specific Types

Another option is to make the customizer that is used on that annotation a different type (eg. PulsarListenerConsumerBuilderCustomizer) and that would naturally be exluded by Boot.

  • ✅ No change needed by Boot (could be introduced in framework during RC phase if low risk)
  • ✅ No complicated Boot lookup code
  • ✅ The customizer type makes its purpose clear and direct (vs implied w/ @Qualifer)
  • ❌ Another customizer API introduced

Do Nothing

This was discovered while investigating a user report around consumer customizers (#480) but not directly reported by a user. One option is to simply do nothing until an issue is reported. In many cases having the customizer as the default might not be an issue but if the customizer is doing something highly specific to the application it could be very problematic.

  • ✅ nothing needs to be done now (in line w/ let's not add a bunch of things until user's tell us what they want)
  • ❌ could be an unpleasant surprise to users
  • ❌ introducing the concepts later could be a breaking change/ripple to users

ℹ️ This applies to the following so any chosen solution w/ ripple across these areas:

  • ConsumerBuilderCustomizer w/ @PulsarListener
  • ReaderBuilderCustomizer w/ @PulsarReader
  • ReactiveMessageConsumerBuilderCustomizer w/ @ReactivePulsarListener

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions