Marious
Marious

Reputation: 181

Spring Cloud Function GCP exclude for Spring Cloud Stream for PubSub

I combine both Spring Cloud Function for GCP and Spring Cloud Stream for PubSub in the same project. I have one function which is an entrypoint for GCP CF defined in my properties spring.cloud.function.definition=gcpFunction

I bridge the result of the function with Spring Cloud Stream binding by StreamBridge.

Unexpectedly Spring Cloud Stream also automatically binds the gcpFunction function and creates an unwanted topic in PubSub. I would like to exclude the function from the automatic binding for Spring Cloud Stream. The only workaround I found is to bind Spring Cloud Function explicitly to none existing function e.g. spring.cloud.stream.function.definition=doNotBindFunction

This is not ideal because Spring during startup prints some warnings about a missing function and also looks a bit hacky. Is there any other recommended solution?

I looked at the following topics but seems like they don't really solve many problem Is it possible to disable spring-cloud-stream's functional binding for a specific method? as @SpringBootApplication(exclude = ContextFunctionCatalogAutoConfiguration.class) disables also configuration for my gcpFunction

Upvotes: 1

Views: 846

Answers (1)

Elena Felder
Elena Felder

Reputation: 466

Try setting spring.cloud.stream.function.autodetect=false. This will turn off autodiscovery of functional beans (refdoc).

Upvotes: 0

Related Questions