-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Pulsar default tenant/namespace #41851
Conversation
This commit allows Pulsar users to configure a default tenant and/or namespace to be used when producing or consuming messages to topic URLs that are not fully-qualified. The following changes accomplish this: - add `tenant` and `namespace` config props to `spring.pulsar.defaults` - auto-configure a `PulsarTopicBuilder` bean populated w/ above props - provide above topic builder to producer/consumer/reader factories (imperative and reactive) - add tests for all of the above
The builder is stateful and as such each injection point needs its own bean instance.
/** | ||
* Default tenant to use when producing or consuming messages against a | ||
* non-fully-qualified topic URL. When not specified Pulsar uses a default tenant | ||
* of 'public'. | ||
*/ | ||
private String tenant; | ||
|
||
/** | ||
* Default namespace to use when producing or consuming messages against a | ||
* non-fully-qualified topic URL. When not specified Pulsar uses a default | ||
* namespace of 'default'. | ||
*/ | ||
private String namespace; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As these properties both relate to topics, it would be good to put them both in a topic
group so they'd become spring.pulsar.defaults.topic.tenant
and spring.pulsar.defaults.topic.namespace
. I think that still makes sense given that typeMappings
is partially topic related. What do you think though, @cbono?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great suggestion as this also gives way to adding an enabled
flag to the spring.pulsar.defaults.topic
to disable default topics if so desired.
...nfigure/src/main/java/org/springframework/boot/autoconfigure/pulsar/PulsarConfiguration.java
Show resolved
Hide resolved
This commit allows Pulsar users to configure a default tenant and/or namespace to be used when producing or consuming messages to topic URLs that are not fully-qualified. See gh-41851
This commit allows Pulsar users to configure a default tenant and/or namespace to be used when producing or consuming messages to topic URLs that are not fully-qualified.
The following changes accomplish this:
tenant
andnamespace
config props tospring.pulsar.defaults
PulsarTopicBuilder
bean populated w/ above props