GoogleCloudPlatform / spring-cloud-gcp

New home for Spring Cloud GCP development starting with version 2.0.
Apache License 2.0
415 stars 307 forks source link

Pubsub subscriber config #2386

Closed ValdasK closed 9 months ago

ValdasK commented 9 months ago

Can you use spring boot config file to define individual subscriber settings (e.g. number of threads, thread name) for subscriptions that are added via PubSubInboundChannelAdapter?

If not, how such settings could be changed via code?

I cannot figure out if this is supported (if yes, then it's undocumented?)

What I want to change is that instead of default 4 threads that perform whole pubsub execution is to split several topics which take long to process into their own threads so they do not block processing of fast messages, is this doable?

We are using spring-cloud-gcp-starter-pubsub with defaults

meltsufin commented 9 months ago

If you are using the starter, the relevant config properties do apply.

ValdasK commented 9 months ago

Thank you, I somehow have missed part about spring.cloud.gcp.pubsub.subscription.[subscription-name].executor-threads

Correct me if I am wrong, setting this to something like 4 would mean that there would be 4 generic message threads coming from global config, processing all messages; and 4 threads dedicated for [subscription-name] messages? Can I somehow exclude [subscription-name] messages from global execution threads?

meltsufin commented 9 months ago

I believe there will be two thread pools, each with 4 threads. Only one of them, the subscription-specific one, will be used for [subscription-name].