Monday, March 25, 2013

Spring Integration Gateway

Gateway is very handy for communicating between modules.  However, it has a side effect that all headers not specified in the gateway will be lost to those behind the gateway.  i.e. it will only copy those headers that is listed/annotated in the method arguments. 

check GatewayMethodInboundMessageMapper.mapArgumentsToMessage.  Here it construct the message sent into the request channel and it only copy those headers that is in the argument.

But come to think of it, if endpoints behind gateway needs to use a specific header, it's not suppose to know the structure of the message, it should be specified as an input parameter to the gateway method.  It's just that we're developing both the module that calls the gateway and those behind the gateway, we kinda expect the headers will be carried into and behind the gateway. 

No comments:

Post a Comment