springboot version:2.3.7.RELEASE
Listener:
@RabbitListener(queues = RabbitConfig.MARINE_DIRECT_QUEUE)
@RabbitHandler
@Transactional(rollbackFor = Exception.class)
public void onMassage(Channel channel, @Payload MarineSchedule marineSchedule, @Headers Map<String, Object> headers)
rabbitMq config:
@Bean
public RabbitListenerContainerFactory<?> rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
factory.setConcurrentConsumers(2);
factory.setPrefetchCount(10);
factory.setMessageConverter(new Jackson2JsonMessageConverter());
factory.setAcknowledgeMode(AcknowledgeMode.MANUAL);
return factory;
}
Error: Application deserialize MarineSchedule class use RabbitMq Message header's TypeId。when remove @Headers
annotation, deserialize ok.
Comment From: snicoll
Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.
Comment From: GOODBOY008
@snicoll I have supply a small project to reproduce this bug.Here is my project.https://github.com/GOODBOY008/amqp-issue.git. I'm waiting for your response! Thank you. If it is a bug,I'm willing to contribute.
Comment From: snicoll
@GOODBOY008 thank you for the sample and the offer to contribute. Spring Boot 2.3.7.RELEASE
was released in December last year. Please consider testing the latest bug fix in that line before reporting an issue. I've upgraded your sample to 2.3.10.RELEASE
and it is working as expected. Note that 2.3.x
has reached its end of OSS support so please upgrade to a more recent version at your earliest convenience.
Comment From: GOODBOY008
@GOODBOY008 thank you for the sample and the offer to contribute. Spring Boot
2.3.7.RELEASE
was released in December last year. Please consider testing the latest bug fix in that line before reporting an issue. I've upgraded your sample to2.3.10.RELEASE
and it is working as expected. Note that2.3.x
has reached its end of OSS support so please upgrade to a more recent version at your earliest convenience.
Thank you very much for your reply.