【发布时间】:2020-10-06 20:18:19
【问题描述】:
鉴于我有 IntegrationFlow 和 AMQP 队列的入站适配器:
@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();
}
当某些外部系统发送带有 JSON 正文的消息时,我发现他们使用 __TypeId__=THEIR_INTERNAL_CLASS。
我想将 JSON 正文映射到我自己的类。
目前,它在ClassCastException 上失败,因为THEIR_INTERNAL_CLASS 不可用。
我如何告诉Jackson2JsonMessageConverter 使用我自己的类?
【问题讨论】:
标签: spring-integration spring-amqp spring-integration-dsl spring-integration-amqp