spring integration - int-http:inbound-gateway same request Channel and different Response channel issue -
spring integration - int-http:inbound-gateway same request Channel and different Response channel issue -
i have 2 int-http:inbound-gateway path mentioned below.and points same request channel have different reply-channel.
http://localhost:8080/xyz/abcservice/query -- expected phone call http:inbound-gateway id ="xyz" http://localhost:8080/abcservice/query - expected phone call http:inbound-gateway id ="default"
but happing in not consistence when give request
http://localhost:8080/xyz/abcservice/query
it calling "default" gateway other time calling "xyz" i.e not consistence. or not sure may phone call correctly instead gives response different reply-channel ?
i using dispatcherservlet.below spring-integration.xml
<int-http:inbound-gateway id="default" path="/*service/query" request-channel="requestchannel" reply-channel="responsechannel" supported-methods="post" reply-timeout="5000" request-payload-type="java.lang.string" error-channel="errorchannel" mapped-request-headers="xyz-*, http_request_headers"> <int-http:header name="reply-type" expression="'default'" /> </int-http:inbound-gateway> <int-http:inbound-gateway id="xyz" path="/xyz/*service/query" request-channel="requestchannel" reply-channel="xyzexporttransformedchannel" supported-methods="post" reply-timeout="5000" request-payload-type="java.lang.string" error-channel="errorchannel" mapped-request-headers="xyz-*, http_request_headers"> <int-http:header name="reply-type" expression="'abc'" /> </int-http:inbound-gateway> <!--all endpoints output chanlle commonresonsechannel --> <int:channel id="commonresponsechannel"> </int:channel> <!-- final router --> <int:header-value-router input-channel="commonresponsechannel" header-name="reply-type"> <int:mapping value="default" channel="responsechannel" /> <int:mapping value="abc" channel="xyzresponsechannel" /> </int:header-value-router> <int:channel id="responsechannel"> </int:channel> <int:channel id="xyzresponsechannel"> </int:channel> <int:transformer input-channel="xyzresponsechannel" output-channel="xyzexporttransformedchannel" id="transformerchannel" ref="objtocsvtransformer"></int:transformer> <bean class="sometransformer" id="objtocsvtransformer"></bean> <int:channel id="xyzexporttransformedchannel" /> have opened question before not not clear.not sure how update that.so opened new one.
you should not configure reply channels way; may cause unpredictable results.
reply-channel
s bridged message replychannel
header work ok, it's unpredictable because bridge set when gateway first receives message.
instead, omit reply-channel
attributes on gateways , allow framework route replies straight using replychannel
header.
instead of router, configure "bridge nowhere" (a <bridge/>
input-channel= commonresponsechannel"
, no output-channel
.
or omit output-channel
on lastly endpoints (instead of sending commonresponsechannel
).
spring-integration
Comments
Post a Comment