I referred to the example posted here. I am trying to run Multiple spring cloud stream application together. Here the output of first is given as input to other. Below is what I am trying to do.
@Bean
public Function<KStream<FormUUID, FormData>, KStream<UUID, Application>> process()
{
//do some processing here and return
}
// read output from above process and join it with an event stream
@Bean
public BiConsumer<KStream<UUID, ProcessEvent>, KTable<UUID, Application>> listen()
{
return (eventStream,appTable )-> eventStream
.join(appTable, (event, app) -> app).foreach((k, app) -> app.createQuote());
}
The application.yml looks like below
spring.cloud:
function: process;listen
stream:
kafka.streams:
bindings:
process-in-0.consumer.application-id: form-aggregator
listen-in-0.consumer.application-id: event-processor
listen-in-1.consumer.application-id: event-processor
binder.configuration:
default.key.serde: org.springframework.kafka.support.serializer.JsonSerde
default.value.serde: org.springframework.kafka.support.serializer.JsonSerde
spring.json.key.default.type: com.xxx.datamapper.domain.FormUUID
spring.json.value.default.type: com.xxx.datamapper.domain.FormData
commit.interval.ms: 1000
bindings:
process-in-0.destination: FORM_DATA_TOPIC
process-out-0.destination: APPLICATION_TOPIC
listen-in-0.destination: APPLICATION_TOPIC
listen-in-1.destination: PROCESS_TOPIC
Above configuration throws
java.lang.IllegalStateException: Multiple functions found, but function definition property is not set.
if I try to use below configuration
spring.cloud.stream.function.definition: processAndListen
Then my application works but the second stream config (defined in listen Bean) doesnt gets executed.