I am consuming SOAP web service using inbound-gateway.We need to put message in kafka topic and return a synchronous acknowledgement to requestor using declarative way of spring integration. Is this possible ?

    public Acknowledgement process(@RequestPayload MessagePayload payload) {
    // perform validation & logic
    // need to send message to kafka topic using declarative way

    // sending synchronous ack to request originator
    return new Acknowledgement(); 
    }
1

There are 1 answers

1
Gary Russell On

The kafka outbound channel adapter has a sync property setSync(true) when using java config sync="true" when using XML.

The calling thread (web container) will block until kafka assumes responsibility. If you use a publish-subscribe channel, make the kafka adapter the first consumer, and a service to build the Acknowledgement the second consumer (use the order property in the consumers to ensure proper ordering).

Or you can use a KafkaTemplate directly from your controller.