I'm using Spring Cloud AWS messaging to send/receive messages using SQS.
My code looks like this:
@SpringBootApplication
@Import(MessagingConfig.class)
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
@Configuration
public class MessagingConfig {
@Bean
public QueueMessagingTemplate queueMessagingTemplate(AmazonSQS amazonSqs, ResourceIdResolver resourceIdResolver) {
return new QueueMessagingTemplate(amazonSqs, resourceIdResolver);
}
}
The sender code is like this (wired via a controller):
@Component
public class Sender {
@Autowired
private QueueMessagingTemplate queueMessagingTemplate;
public void send(MyMessage message) {
queueMessagingTemplate.convertAndSend("testQueue", message);
}
}
I have an application.yaml
file that defines the AWS parameters that seem to be correctly loaded. So, when I run this application, I get the following warning/error:
Message header with name 'id' and type 'java.util.UUID' cannot be sent as message attribute because it is not supported by SQS.
Is there something that I'm doing wrong here, or is there an issue with the way Spring creates messages for SQS?