0
votes

I have defined an int-http:inbound-gateway which has a request channel and a reply channel. The request channel connects to a service activator which validates the message and returns a message response via its output channel. How does one forward the validated message to another endpoint for further message processing? Its like I need 2 output channels, one for the response and one for the message.

<int-http:inbound-gateway
    request-channel="requestChannel"
    reply-channel="responseChannel"
    supported-methods="POST"
    path="/message/hl7/{source}">
    <int-http:request-mapping
            consumes="application/json" produces="application/json"/>
    <int-http:header name="source" expression="#pathVariables.source"/>
</int-http:inbound-gateway>

<int:service-activator ref="HL7MessageEndpoint"
                       method="POST"
                       input-channel="requestChannel"
                       output-channel="responseChannel"/>

 <!-- need to send original message to jms if service activator validates successfully -->  
2
can you post your work/code highlighting on what you tried? - sakura

2 Answers

1
votes

Change the reply channel to a <publish-subscribe-channel/>. That way, the reply will go back to the gateway and you can subscribe another component. You will probably need to add a task executor to the channel so the downstream flow doesn't run on the web container thread.

0
votes

In your transformer add a flag if the message is valid return MessageBuilder.withPayload(Dto).setHeader("ValidFlag", Dto.getValidFlag().toString()) .build(); Add a router to determine if the message is valid Define in and out channels

`<channel id="requestInChannel"/>
<channel id="outputActivatorInChannel" />
<channel id="validatorInChannel"/>

<header-value-router input-channel="requestInChannel"
    header-name="validFalg" default-output-channel="validatorInChannel"
    resolution-required="false">
    <mapping value="false" channel="outputActivatorInChannel" />
    <mapping value="true" channel="validatorInChannel" />
</header-value-router>`

if the Message is valid make the in channel to two different activators

<int:service-activator ref="OutputActibvator" method="POST" input-channel="validatorInChannel" output-channel="responseChannel"/>