I have been trying to find documentation of @enablesns @enablesqs annotations but can't find them.
They seem to be required for the sqs and sns integration to work. But I'd just like to have a better understanding, and be sure I'm not using them wrong.
Any description would be of great help.
Spring Cloud AWS provides Amazon SQS and Amazon SNS integration that simplifies the publication and consumption of messages over SQS or SNS. While SQS fully relies on the messaging API introduced with Spring 4.0, SNS only partially implements it as the receiving part must be handled differently for push notifications.
Amazon Simple Queue Service (SQS) is a hosted message queuing service for distributing messages amongst machines. You can configure API Gateway to poll an Amazon SQS queue at a set rate. Any message found on the SQS queue in this interval can be sent to a policy for processing.
Spring Cloud for AWS comes into play as an integrator of AWS services. In this tutorial, we'll develop a demo application that integrates with the core services Amazon Simple Storage Service (Amazon S3) and Amazon Simple Queue Service (Amazon SQS).
Looking at the source code for those two annotations:
@Import({SnsConfiguration.class, SnsWebConfiguration.class})
public @interface EnableSns
Where @Import
does the following:
@interface Import: Indicates one or more @Configuration classes to import.
Long story short: Those annotations only combine multiple @Configuration
classes into one single annotation.
E.g. @EnableSns
does the same as adding @SnsConfiguration
and @SnsWebConfiguration
which provide you with AmazonSNS
, RegionProvider
and AWSCredentialsProvider
beans.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With