I have IntegrationFlow which listens for AMQP messages and I want to log XML message payload.
IntegrationFlows.from(
Amqp.inboundAdapter(rabbitConnectionFactory, QUEUE)
.messageConverter(new MarshallingMessageConverter(xmlMarshaller))
)
.log(INFO, "org.springframework.amqp")
...
.get();
When I use MarshallingMessageConverter in Amqp.inboundAdapter(), then already deserialized object instead of XML payload is logged in .log() step
I can get around this problem with default SimpleMessageConverter and explicit .transform() step.
Is there a way how to log original XML payload and keep using MarshallingMessageConverter?
One of the way is to add a
MessagePostProcessorinto a listener container:Another one, of course, is to extend that
MarshallingMessageConverterand override itsfromMessage(Message message)to log the body before callingsuper.fromMessage().