Folks,
I have a simple Junit test that creates a spring integration message and uses a AMQP outbound channel adapter.
The integration context looks like
toRabbitMessageChannel -> OutBoundAdapter
The payload takes an object of "MyEntity.class"
MyEntity entityRequest = new MyEntity();
entityRequest.setId(1L);
entityRequest.setUri("my URI");
The Message is being sent using the following code
toRabbit.send(new GenericMessage<MyEntity>(entityRequest));
I have autowired the message channel through the follow annotation
@Autowired
@Qualifier("toRabbit")
MessageChannel toRabbit;
So the problem that I am facing is that the message goes out into my Rabbit queue but the payload is zero.
Properties
priority: 0
delivery_mode: 2
headers:
content_type: application/octet-stream
Payload 0 bytes Encoding: string
I single stepped the Junit test in the debugger and I see that the SimpleMessageConverter does not convert the object into a byte array.
In the function convertAndSend after the conversion is done
The "body" field of the "messagetoSend" object is NULL whereas the "message" field has the MyEntity object as set by the Junit test. My understanding is that the SimpleMessageConverter can take in any object and serialize it into a byte array. What am I doing wrong? Also I would like to understand on any transformation I would need to apply to get the object back on the receiving side.


Reply With Quote
