Package io.awspring.cloud.sqs.sample
Class SnsNotificationSample
java.lang.Object
io.awspring.cloud.sqs.sample.SnsNotificationSample
Sample demonstrating how to receive SNS notifications from SQS.
- Author:
- Damien Chomat
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA custom message record for demonstration purposes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReceives SNS notifications from the "sns-notification-custom-queue" SQS queue.org.springframework.boot.ApplicationRunnersendSnsNotificationMessage(SqsTemplate sqsTemplate) ApplicationRunner to send sample SNS messages to the queues for demonstration purposes.
-
Constructor Details
-
SnsNotificationSample
public SnsNotificationSample()
-
-
Method Details
-
receiveCustomMessage
@SqsListener("sns-notification-custom-queue") public void receiveCustomMessage(SnsNotification<SnsNotificationSample.CustomMessage> notification) Receives SNS notifications from the "sns-notification-custom-queue" SQS queue. The message payload is automatically converted to a CustomMessage object.- Parameters:
notification- the SNS notification wrapper containing the message and metadata
-
sendSnsNotificationMessage
@Bean public org.springframework.boot.ApplicationRunner sendSnsNotificationMessage(SqsTemplate sqsTemplate) ApplicationRunner to send sample SNS messages to the queues for demonstration purposes. This simulates SNS notifications being sent to SQS queues that are subscribed to SNS topics.
-