spring-pulsar icon indicating copy to clipboard operation
spring-pulsar copied to clipboard

Ability to configure a default topic and namespace

Open onobc opened this issue 1 year ago • 2 comments

There is not currently a way to configure the default tenant and namespace to use. As a result, users have to specify the tenant and namespace in their topic references - otherwise the default public/default is used.

It would improve user experience if there was a config property for tenant and namespace.

Original ask on Stackoverflow: https://stackoverflow.com/questions/78797365/configuring-namespace-and-tenant-for-spring-pulsar

onobc avatar Jul 26 '24 15:07 onobc

I asked it Gen AI the same question and it came back with setting spring.pulsar.client.namespace and spring.pulsar.client.tenant. That seems to work. Is there a reason that wouldn't work?

eljefe6a avatar Jul 27 '24 15:07 eljefe6a

Hi @eljefe6a

That seems to work.

Did you see it actually work :)

Is there a reason that wouldn't work?

Gen AI did pretty good in that is exactly what the property will be once implemented. It is not available currently (see PulsarProperties). Gen AI is smart enough to know the prefix is spring.pulsar and that it is likely in the client properties.

onobc avatar Jul 27 '24 17:07 onobc

I can see this is flagged "needs auto-configuration". This broke the Spring Boot build and the deprecation note isn't helpful as the topic builder isn't auto-configured. Also, creating a new builder works so I am wondering if the deprecation note is correct or is Spring Pulsar only meant to be used with Spring Boot?

snicoll avatar Aug 13 '24 06:08 snicoll

Thanks for the heads up @snicoll.

This broke the Spring Boot build

My bad, I did not realize that SB main had already updated to the 1.2.0-SNAPSHOT. I was already in the process of submitting a PR that updates to the latest.

and the deprecation note isn't helpful as the topic builder isn't auto-configured

The intent is to auto-configure it (PR mentioned above).

Also, creating a new builder works so I am wondering if the deprecation note is correct or is Spring Pulsar only meant to be used with Spring Boot?

Good point. I will adjust the deprecation note to include the non-SB usage as well.

I should have something submitted end-of-day.

onobc avatar Aug 13 '24 13:08 onobc

Closing via https://github.com/spring-projects/spring-pulsar/commit/6d23378fbb57a50c3a302be136f9173d2854085d

onobc avatar Aug 14 '24 00:08 onobc

Here is the SB PR https://github.com/spring-projects/spring-boot/pull/41851

onobc avatar Aug 14 '24 01:08 onobc