Announcement Announcement Module
No announcement yet.
HTTP inbound gateway with asynchronous AMQP queues Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • HTTP inbound gateway with asynchronous AMQP queues


    I'm having trouble getting the follow design to work:
    1. Client receives a work request via a HTTP inbound gateway.
    2. A job is built from the HTTP request and sent to a job orcherstrator over a AMQP gateway (I want to use request/reply for this interface)
    3. The job is processed by the orchestrator by sending it onto workers over AMQP queues (using AMQP outbound adapters).
    4. The work unit process the job and update it. It is then returned asynchronously to the orchestrator on a separate queue (AMQP inbound adapter).
    5. Once all of the responses are gathered by the orchestrator it updates the job to say it is finished and returns it to client over the AMQP gateway
    6. Client receives the reply and returns the response back to the sender of the HTTP request

    It all works up to step 5 where the orchestrator returns the reply back to the client (over the AMQP gateway). The orchestrator throws the following exception
    Caused by: no output-channel or replyChannel header available
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage( ~[spring-integration-core-2.1.0.RELEASE.jar:na]
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.produceReply( ~[spring-integration-core-2.1.0.RELEASE.jar:na]
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleResult( ~[spring-integration-core-2.1.0.RELEASE.jar:na]
    What appears to be happening is the message amqp headers from the HTTP client request are being overridden when the orchestrator sends the job on the AMQP adapters to the workers downstream. This means when the AMQP gateway tries to send the job back to the HTTP client it cannot find the headers it needs from the request.

    I've tried saving the message headers from the client request and restoring them before sending a response. However this doesn't work either - the work orchestrator appears to send the reply successfully but HTTP client's AMQP gateway doesn't receive it (or ignores it). I have noticed that even though I build the reply with request headers the header 'id' field of the sent reply is different.

    Is there way to resolve this issue or is my mixing of AMQP gateways and adapters flawed?