-
Notifications
You must be signed in to change notification settings - Fork 292
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
Customize thread name prefixes for subscription specific TaskSchedulers #1152
Customize thread name prefixes for subscription specific TaskSchedulers #1152
Conversation
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.
It's a nice improvement, but unfortunately accepting a bean in GcpPubSubAutoConfiguration
constructor that is defined in the same autoconfiguration class leads to a circular reference. You can test this by starting up the sample app.
I see two ways around this:
- creating
defaultSelectiveSchedulerThreadNameProvider
in a new autoconfiguration class, - not providing a default bean at all and instead accepting
Optional<SelectiveSchedulerThreadNameProvider> selectiveSchedulerThreadNameProvider
in the constructor. Then inregisterSelectiveSchedulerBeans
, the default would end up hardcoded as before:
String threadName = selectiveSchedulerThreadNameProvider.isPresent() ?
selectiveSchedulerThreadNameProvider.get().getThreadName(fullSubscriptionName) :
"gcp-pubsub-subscriber-" + qualifiedName;
The second way seems simpler to me, but it's your call.
Also, could you turn on google style and reformat? mvn validate
will run style checks to make sure it's good.
54d294a
to
7eff256
Compare
You're obviously right, sorry for that. |
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.
Looks great!
Would you mind adding a line or two to the Subscription-specific Configurations section in the reference documentation?
8973e4c
to
68c4fa9
Compare
Sure, reference added. Please check if that concludes the change. |
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.
Thank you very much!
Kudos, SonarCloud Quality Gate passed! |
Hey @elefeint ! I don't know where to ask this question elsewhere - Do you have any ETA for publishing new version of spring-cloud-gcp ? |
We'll release in the next 2 weeks. Need to get Spring Boot 2.7 compatibility in. |
…rs (GoogleCloudPlatform#1152) * Allow to customize thread name prefixes for subscription specific TaskSchedulers
Currently thread names for subscription specific Task Schedulers are lengthy as they comprise of
gcp-pubsub-subscriber-
+ fully qualified subscription name, ex:gcp-pubsub-subscriber-projects/fake project/subscriptions/subscription-name1
This may result in a lengthy log statement, if thread name is a part of it.
This MR allows customization of subscription specific Task Scheduler's thread names.