I am using spring-cloud-aws SqsListener to receive AWS SNS HTTP notifications in JSON Format from the AWS Simple Queue Service (SQS).
This is the code for the listener:
@SqsListener(value = "my-queue", deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS)
public void handle(final MyObject obj) throws Exception {
}
The documentation linked above only applies to sending and reading simple sequential objects into a queue, and I thought that receiving SNS messages was expected to work out of the box. But I get conversion errors:
10: 45: 51.480 [simpleMessageListenerContainer-2] ERROR oscamlSimpleMessageListenerContainer - Collision excluded during message processing. org.springframework.messaging.MessagingException: exception occurred while calling the handler method; org.springframework.messaging.converter.MessageConversionException nested exception: No converter found to convert to class com.myproject.model.MyObject, message = GenericMessage
I also tried to create a wrapper object that looks like the expected SNS Json Format linked above, but I still get the same exception. The only type that works is the string in the signature. Shouldn't I automatically convert SNS?