We are implementing a scenario where we want to call a single webservice gateway from multiple flows. We want to configure this gateway in one context and import that context into several flow context files. For this reason we need to dynamically specify the reply-channel for the webservice gateway, because we don't know to which channel it needs to respond to. This can be achieved by setting the reply channel of the message being sent to the webservice gateway. It all works nicely until we want to invoke this flow from a gateway proxy. The gateway proxy is using some internal temporary channel, which if we override in the message it will send the message to the overriding channel instead of just returning it through the interface method. This results in an infinite loop.
I can think of a number of workarounds for this issue, but what's really bugging me is the fact that we are doing something really simple and straightforward here that I strongly feel is supported by the framework in some way. Please let me know where our assumptions are failing us, and what could be a good solution for the problem. Here is a minimalist sample flow showing the problem:
And the definition of SeiService:Code:<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.1.xsd"> <int:gateway service-interface="myseitest.SeiService"/> <int:channel id="inputChannel1"/> <int:channel id="outputChannel1"/> <int:chain id="flow1" input-channel="inputChannel1" output-channel="wsInputChannel"> <int:transformer expression="payload + '-flow1'"/> <int:header-enricher> <int:reply-channel ref="postprocess1" overwrite="true"/> </int:header-enricher> </int:chain> <int:channel id="inputChannel2"/> <int:channel id="outputChannel2"/> <int:chain id="flow2" input-channel="inputChannel2" output-channel="wsInputChannel"> <int:transformer expression="payload + '-flow2'"/> <int:header-enricher> <int:reply-channel ref="postprocess2" overwrite="true"/> </int:header-enricher> </int:chain> <int:channel id="wsInputChannel"/> <int:transformer id="wsCall" input-channel="wsInputChannel" expression="payload + ':WS-RESULT'"/> <int:channel id="postprocess1"/> <int:transformer input-channel="postprocess1" output-channel="outputChannel1" expression="payload + '-postprocess1'"/> <int:channel id="postprocess2"/> <int:transformer input-channel="postprocess2" output-channel="outputChannel2" expression="payload + '-postprocess2'"/> </beans>
Thank you!Code:package myseitest; import org.springframework.integration.annotation.Gateway; public interface SeiService { @Gateway(requestChannel = "inputChannel1", replyChannel = "outputChannel1") String operation1(String message); @Gateway(requestChannel = "inputChannel2", replyChannel = "outputChannel2") String operation2(String message); }
Adam Sandor
www.DVSK.sk


Reply With Quote
