I try to publish a message on a Queue with RabbitTemplate (using Spring Boot) and I got this message. I already tried to search for a solution.
Caused by: java.lang.IllegalArgumentException: SimpleMessageConverter only supports String, byte[] and Serializable payloads, received: com.example.demo.SimpleMessage
Maybe this part of code can help
@Override
public void run(String...strings) throws Exception {
SimpleMessage simpleMessage = new SimpleMessage();
simpleMessage.setName("FirstMessage");
simpleMessage.setDescription("simpleDescription");
rabbitTemplate.convertAndSend("TestExchange", "testRouting", simpleMessage);
}
I appreciate any collaboration.
SimpleMessageConverter.createMessage
is being called. I can't remember if convertAndSend calls that for you or not. – RoadsideMessageConverter.toMessage
which callsMessageConverter.createMessage
and since this is an instance ofSimpleMessage
we getSimpleMessageConverter.createMessage
. – Roadside