spring-cloud-stream-samples icon indicating copy to clipboard operation
spring-cloud-stream-samples copied to clipboard

Multi Binder with based on business logic

Open voodemsanthosh opened this issue 4 years ago • 0 comments

Hi Team,

I am trying to find best solution on Spring steam with functions. My requirement like below,

We will get request data in a topic(X) and have to respond to two different topics(Y and Z) based on my business logic.

I implemented below code snippet for general process on same topic,

Processer.java

@Bean
public Function<request, response> process() {
 // here i just process my request and return response
}

Configuration:

spring: cloud: stream: function: definition: process bindings: process-in-0: destination: X contentType: application/json group: x-input kafka: binder: brokers: localhost:9092

But now requirement got changed like below.

  1. incase of my request data contains error, I need to publish response to topic Y
  2. incase of my request data processed successfully, I need to publish my response to topic Y and request data to topic Z.

Both topics are available on same brokers.

Please suggest and guide me with good documents and example to design this.

voodemsanthosh avatar Jun 19 '21 14:06 voodemsanthosh