Using RabbitMQ and Spring, I have been able to successfully send and receive string messages.
However, when I send an object that is a class composed of strings and numbers (a json class), the @RabbitListener issues the following exception when a message is received:
2016-03-14 12:46:03 [SimpleAsyncTaskExecutor-1] [31mWARN [0;39m [36mo.s.a.r.l.ConditionalRejectingErrorHandler [0;39m - Execution of Rabbit message listener failed.
org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener method could not be invoked with the incoming message
Endpoint handler details:
With cause of:
Caused by: org.springframework.messaging.handler.annotation.support.MethodArgumentNotValidException: Could not resolve method parameter at index 0 in method:
and suggestion of: [@Payload param is required]]
Here is the send:
DocumentConversionModel createdHandler = template.convertSendAndReceive(EXCHANGE_NAME, '', documentHandler)
Here is the receiver:
@RabbitListener(queues = QUEUE_NAME)
DocumentConversionModel receive(DocumentHandler inHandler) { ...}
DocumentHandler is a class that contains json fields of strings and integers.
I am using Groovy and when I substitute "def documentHandler" as the receiver params, there is no exception. However, there is no class data available.
I assume that the convertSendAndReceive is doing some type of conversion of the message, but I don't know to what.
Is there a sample available that shows how to send and receive objects other than strings or numbers?