Given the simple application:
@SpringBootApplication
public class StreamApp {
@Bean
Consumer<Message<?>> logSink() { return System.out::println; }
public static void main(String[] args) {
SpringApplication.run(StreamApp.class, args);
}
}
I can bind a destination such as a Kafka topic to the logSink
function by supplying config:
spring.cloud.stream.bindings.logSink-in-0.destination=dogs-topic
Is there a way I could create another separate binding using the same logSink
function? I know that the destination property accepts a comma separated list, but I want the ability to configure the bindings separately.
I can do this by setting an alias on the function, i.e. @Bean({"logSinkOne", "logSinkTwo"})
and then supplying config:
spring.cloud.stream.bindings.logSinkOne-in-0.destination=dogs-topic
spring.cloud.stream.bindings.logSinkTwo-in-0.destination=cats-topic
however it would be great to avoid adding these alias's ahead of time.