spring-cloud-aws: SQS deserialization fails with a list of items as payload
Type: Bug
Component: SQS
Describe the bug
When you have a List of Items as a payload the deserialization will throw an MessageConversionException
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `com.example.demo.Item` from Array value (token `JsonToken.START_ARRAY`)
at [Source: (String)"[{foo=foo, bar=bar}, {foo=foo, bar=null}, {foo=null, bar=bar}]"; line: 1, column: 1]
For a single item it works fine
Sample I created a sample project with 2 endpoints which help showing the problem.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 24 (10 by maintainers)
@tomazfernandes that is a very good summary, thanks 😃
Hi @huehnerlady, I also appreciate your patience with the delays.
I think in the end what we found out is that, while the previous version supported adding a
List<POJO>directly as the payload for a single message, the current implementation took a different approach and now understands a List<POJO> as a list of objects to be sent one in each message.This new approach IMO is more efficient in that you can leverage SQS batch send and batch receive to send and receive many more messages in a single network call independently of each other, so you get separate receive counts, DLQs, etc.
So I think keeping the wrapper object is a reasonable tradeoff, and now you can send and receive many wrapper objects in the same call (as long as it does not exceed SQS payload limits).
The new open issue would enable us to send many batches of up to 10 messages in parallel, which could contain wrapper objects in the payload if that’s better for you, thus increasing the overall send throughput by a good amount compared to the previous version or what we can do OOTB in this one.
For now, you can definitely simply partition your list of messages in batches of 10 and send them using the async method, while waiting on the completion of all the returned futures.
Makes sense to you, or am I missing anything?
Thanks