springspring-integrationspring-integration-dslenterprise-integrationspring-integration-amqp

Spring Integration reply to Publisher


I have 2 flows implemented in Spring Integration using DSL:

The first flow is just a HTTP Message Publisher for clients who cannot publish directly to AMQP. How can I let the Publisher know when the message processing failed in Service?

I was looking at Publisher Confirms and Service Acks pattern with DirectChannel, so that the Publisher can synchronously receive the error message, if I understand this correctly. However this will block the Publisher until Service returns (or throws Exception). What are the options in Spring Integration (since it is EIP based) to handle such situation where the Publisher should be informed of message processing failures without being blocked? This is also more of a design question.


Solution

  • REST -> AMQPoutboundGateway -> AmqpInboundGateway -> Service

    By using gateways, the outbound gateway will block awaiting a 'success' reply from the service.

    Add an error channel to the inbound gateway; if the service fails, the error flow will be invoked, and you can configure that flow to return the failure to the calling gateway.

    You can use an async outbound gateway if you don't want to block, but then you'll need some other mechanism to return the result to the caller.