How do I send and receive a Java Object from SQS? For instance, I have a java object Log. I send the object to the message queue as
this.getSqs().sendMessage(new SendMessageRequest(myQueueUrl, log.toString());
However, at the time of retrieving the message from queue, I want to be able to retrieve it as List<Log>
and use it as a java Log object inside my application. Any pointers on how to do that?
You have to serialize the message to a string, additionally making sure that all the characters are in the allowed character range.
One way to do it is to use Java serialization (though it's not the best method for serialization, it often works), and then encode the result using e.g. Base64.
For an example see: SoftwareMill common Queue and SoftwareMill common Util