I use RabbitMQ to send messages to the queue and to the recipient, I receive it, but I can not use it.
When I send it, I do it.
rabbitTemplate.convertAndSend("myExchange", "binding", MyObject);
MyObjectis a custom object created in this project. In another project, I created in MyObject.classexactly the same way (but I know that the signature of the object is not the same).
The converted set for my listener is as follows.
Jackson2JsonMessageConverter jsonMessageConverter() {
Jackson2JsonMessageConverter messageConverter = new Jackson2JsonMessageConverter();
messageConverter.setClassMapper(classMapper());
return messageConverter;
}
private ClassMapper classMapper() {
DefaultClassMapper classMapper = new DefaultClassMapper();
classMapper.setDefaultType(MyObject.class);
return classMapper;
}
So, for my listener, the following code does not work. I noticed that the body comes with [B@1232(byte[232].
@Override
public void onMessage(final Message message) {
final MyObject myObject = (MyObject) messageConverter.fromMessage(message);
How do I achieve this?
source
share