Given I have IntegrationFlow
and inbound adapter for AMQP queue:
@Bean
public IntegrationFlow readMessagesFlow(
ConnectionFactory rabbitConnectionFactory,
ObjectMapper jacksonObjectMapper) {
return IntegrationFlows.from(
Amqp.inboundAdapter(rabbitConnectionFactory, QUEUE)
.messageConverter(new Jackson2JsonMessageConverter(jacksonObjectMapper))
)
.log(INFO, AMQP_LOGGER_CATEGORY)
.get();
}
When some external system sends a message with JSON body, I found they use __TypeId__=THEIR_INTERNAL_CLASS
.
I would like to map JSON body to my own class.
Currently, it fails on ClassCastException
because of THEIR_INTERNAL_CLASS
not being available.
How can I tell Jackson2JsonMessageConverter
to use my own class?
This is one way how to do it:
and use
messageConverter
inAmqp.inboundAdapter