First of all you can configure Jms.inboundGateway()
with the MarshallingMessageConverter
:
/**
* @param messageConverter the messageConverter.
* @return the spec.
* @see ChannelPublishingJmsMessageListener#setMessageConverter(MessageConverter)
*/
public S jmsMessageConverter(MessageConverter messageConverter) {
this.target.getListener().setMessageConverter(messageConverter);
return _this();
}
But if you still insist for the .transform()
, then consider to use UnmarshallingTransformer
:
/**
* An implementation of {@link Transformer} that delegates to an OXM
* {@link Unmarshaller}. Expects the payload to be of type {@link Document},
* {@link String}, {@link File}, {@link Source} or to have an instance of
* {@link SourceFactory} that can convert to a {@link Source}. If
* {@link #alwaysUseSourceFactory} is set to true, then the {@link SourceFactory}
* will be used to create the {@link Source} regardless of payload type.
* <p>
* The {@link #alwaysUseSourceFactory} is ignored if payload is
* {@link org.springframework.ws.mime.MimeMessage}.
* <p>
* The Unmarshaller may return a Message, but if the return value is not
* already a Message instance, a new Message will be created with that
* return value as its payload.
*
* @author Jonas Partner
* @author Artem Bilan
*/
public class UnmarshallingTransformer extends AbstractPayloadTransformer<Object, Object> {
https://docs.spring.io/spring-integration/docs/5.0.4.RELEASE/reference/html/xml.html#xml-unmarshalling-transformer