There are two ways to apply transformations one is to use the transformer as a MessageHandler in conjunction with a HandlerEndpoint. The alternative is to carry out the transformation with a queue send or receive call, MessageTransformingChannelInterceptor is provided to allow this.
Currently both approaches require that an instance of PayloadTransformer be wrapped in a PayloadTransformingMessageHandler.
Code:
<marshalling-transformer id="marshaller" marshaller="castorMarshaller"/>
<beans:bean id="transformingHandler" class="org.springframework.integration.transformer.PayloadTransformingMessageHandler">
<beans:constructor-arg ref="marshaller" />
</beans:bean>
If you choose to apply the transformation on the channel then you have the option of having a series of interceptors for the channel each one representing an individual transformation.
Code:
<channel id="tranformingChannel">
<interceptor ref="oxmTransformingInterceptor"/>
<interceptor ref="xsltTransformingInterceptor"/>
</channel>
Alternatively you can use a handler chain in conjunction with either a HandlerEndpoint or MessageTransformingChannelInterceptor.
Code:
<handler-chain id="transformationChain">
<handler ref="transformingHandlerOne" />
<handler ref="transformingHandlerTwo" />
</handler-chain>