Class SnsNotificationSample

java.lang.Object
io.awspring.cloud.sqs.sample.SnsNotificationSample

@Component public class SnsNotificationSample extends Object
Sample demonstrating how to receive SNS notifications from SQS.
Author:
Damien Chomat
  • 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.