1
votes

Just trying out Spring Cloud Stream & SCDF and looks quite simple (as Spring usually does). However, stumbled upon something. I've got application.properties which has the following entries. This is a processor application.

spring.cloud.stream.bindings.input.destination=work.in
spring.cloud.stream.bindings.input.contentType=text/plain
spring.cloud.stream.bindings.input.binder=rabbit
spring.cloud.stream.bindings.input.group=testgroup
spring.cloud.stream.bindings.output.destination=work.out
spring.cloud.stream.bindings.output.contentType=text/plain
spring.cloud.stream.bindings.output.binder=rabbit
spring.cloud.stream.bindings.output.group=testgroup

When I run this as a standalone jar (just like another spring boot app), it honours the application.properties and all works as expected.

When I create a stream using SCDF, then it ignores the properties and creates the exchange using the convention stream_name.app_name which is not what I intended.

Where I would like to be is at some point I want these apps integrated with the spring-cloud config server where I can completely externalize the configs from different sources.

Can someone suggest what am I missing so as to make SCDF pick up my application.properties and does SCDF work with Spring Cloud Config Server (It should be is my understanding)? Any pointers would be much appreciated, thanks.

1

1 Answers

1
votes

By default, the Spring Cloud Stream binding properties are set internally by SCDF with the conventions you mentioned above.

The application.properties you defined at the app level has the lowest precedence and hence they are overridden by what is set by SCDF.

To override these properties set by SCDF, you need to pass the new properties via stream deployment properties. You can refer the documentation for this here

If you are using the Spring Cloud Config server to provide the externalized properties, I believe those can only be used as the stream definition properties and not for the deployment properties like the ones we pass to override the Spring Cloud Stream binding properties.