-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Clarify purpose of Pulsar consumer subscription related properties #42053
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
Comments
Thanks for the report @vpavic , subscription-nameThe
Based on the above downsides I would be in favor of deprecating (for removal) this property in subscription-typeThe Note But this is an opt-in behavior as IFF the user does It may be better suited if we set the default on Thoughts? @wilkinsona @vpavic ? |
This commit moves the default subscription type from the `@PulsarListener` annotation to the container factory (props) which allows the `spring.pulsar.consumer.subscription-type` config prop to be respected. See spring-projects/spring-boot#42053
I wasn't aware of this. Are there any examples of how To clarify my use case - I'm integrating a 3rd party system that exposes a Pulsar topic as a means of subscribing to events published by that system. So nothing Pulsar related is in my control and key settings that impact the listener (topic and subscription names) are changing between different environments. So I'd like to be able to control those solely using configuration properties. Current setup/workaround involve using expressions in
That sounds good, but I assume that configuration facilities behind |
I don't think any of us the Boot team have enough experience of Pulsar to give deep advice, but on the surface both changes seem sensible. We can certainly do them in 3.4. @onobc Do you want to raise issues/PRs for them? |
There are no examples, but rather the other higher-level abstractions (the containers used by
Yes, the default would still be
These properties are only defaults to be used when the user does not specify them on the consumer. Do you mind providing 2 sample Something like: @PulsarListener(topic = "${env}-topic-1", sub = "sub-${env}-topic1")
void listen1(String msg)
@PulsarListener(topic = "${env}-topic-2", sub = "sub-${env}-topic2")
void listen2(String msg) |
That's the point - there's only a single topic/subscription. From my experience, that isn't an uncommon pattern. Over the years I've seen quite a few systems that expose a single subscribable interface (basically a topic) that's then used to receive different messages. Anyway, to be more specific in my case it's Tuya - you can read more details about this in their developer documentation. What I currently have is basically this ( spring.pulsar.client.authentication.plugin-class-name=my.custom.Authentication
spring.pulsar.consumer.topics=${my.other.prop}/out/event @PulsarListener(subscriptionName = "${my.other.prop}-sub", subscriptionType = SubscriptionType.Failover)
void receive(byte[] message) {
// process the message
} |
Thanks @vpavic - the single topic/sub simplifies things greatly. If you could have these properties: spring.pulsar.client.authentication.plugin-class-name=my.custom.Authentication
spring.pulsar.consumer.topics=${my.other.prop}/out/event
spring.pulsar.consumer.subscription.name=${my.other.prop}-sub
spring.pulsar.consumer.subscription.type=Failover and this listener: @PulsarListener
void receive(byte[] message) {
// process the message
} then you would be good. Correct? The good news is that |
This commit moves the default subscription type from the `@PulsarListener` and `@ReactivePulsarListener` annotation to the associated container factory (props) which allows the Spring Boot `spring.pulsar.consumer.subscription-type` config prop to be respected. See spring-projects/spring-boot#42053
This commit moves the default subscription type from the `@PulsarListener` and `@ReactivePulsarListener` annotation to the associated container factory (props) which allows the Spring Boot `spring.pulsar.consumer.subscription-type` config prop to be respected. See spring-projects/spring-boot#42053
This sounds like what I'd ideally like to have, thanks. So it looks like deprecation of In any case, let me know if I can help with any of the work needed to deliver this, either on Spring Pulsar or Spring Boot side. |
Correct. After digging further and understanding your requirements ai bit more, leaving the subscription name here and giving it the same treatment we did for the subscription type makes sense. Also, the fact that the name can be dynamic w/ property substitution does make it more valuable than a static value (which would be pretty useless).
Thank you for raising these issues! |
The output of There is a small change required on the Boot side to support subscription name. Submitting a PR for this soon. |
The subscription name config prop was not being set on the Pulsar listener container properties. This commit adds the subscription name to the Pulsar property mappers. Resolves spring-projects#42053
This commit moves the default subscription name from the `@PulsarListener` annotation to the container factory (props) which allows the `spring.pulsar.consumer.subscription.name` config prop to be respected. See spring-projects/spring-boot#42053
This commit moves the default subscription name from the `@PulsarListener` and `@ReactivePulsarListener` annotation to the corresponding container factory (props) which allows the `spring.pulsar.consumer.subscription.name` config prop to be respected. See spring-projects/spring-boot#42053
The final limitation was removed here - the docs no longer special-case the subscription name/type properties and config props can be used to configure the listeners. |
This commit moves the default subscription name from the `@PulsarListener` and `@ReactivePulsarListener` annotation to the corresponding container factory (props) which allows the `spring.pulsar.consumer.subscription.name` config prop to be respected. See spring-projects/spring-boot#42053
Thanks @onobc! Closing this one in favor of the other issues/PRs. |
This commit adds an integration test to verify the following Spring Boot config props can be used to configure `@PulsarListener` and `@ReactivePulsarListener`: - `spring.pulsar.consumer.topic` - `spring.pulsar.consumer.subscription.name` - `spring.pulsar.consumer.subscription.type` See spring-projects/spring-boot#42053
This commit adds an integration test to verify the following Spring Boot config props can be used to configure `@PulsarListener` and `@ReactivePulsarListener`: - `spring.pulsar.consumer.topic` - `spring.pulsar.consumer.subscription.name` - `spring.pulsar.consumer.subscription.type` See spring-projects/spring-boot#42053
Some while ago I opened these two issues against the Spring Pulsar project:
spring.pulsar.consumer.subscription.name
configuration property doesn't work spring-pulsar#480spring.pulsar.consumer.subscription.type
configuration property doesn't work spring-pulsar#488After setting up another project recently that uses Spring Pulsar for consuming messages, I've again tripped up on the same thing attempting to set Pulsar consumer subscription related settings using Spring Boot provided configuration properties.
Though Spring Pulsar reference manual now contains the following two tips:
IMO it would be good to revisit these properties as their purpose is (at least to me) unclear at the moment.
/cc @onobc
The text was updated successfully, but these errors were encountered: