spring-cloud-streamspring-cloud-stream-binder

Custom Spring Cloud Stream binder being called for all bindings


In my spring boot application I am connecting to both GCP pub sub and RabbitMq using spring cloud stream bindings.

For pubsub I have created a custom binder (to override the need to have the subscription name in the format.).

But now the application uses the custom binder even for the Rabbit binding even though I am specifying the binder type in each binding. Is there a way to make the binder to be invoked for specific binding?


Solution

  • I was able to make it work.

    I had the custom binder configuration class annotated with @Configuration which was causing it to be automatically registered. By Removing the @Configuration I was able to use the custom binder for specific binding.