How can i confirm the subscription request HTTP from amazon SNS

后端 未结 5 1719
不思量自难忘°
不思量自难忘° 2020-12-30 21:20

I have been searching all over the web and nothing gives a clear answer to confirm the subscription request from amazon SNS. I already send the subscription from the amazon

5条回答
  •  渐次进展
    2020-12-30 21:48

    Spring cloud SNS subscription with annotation

    spring cloud AWS has support for auto confirmation of subscriber, you just need to put this annotation "@NotificationSubscriptionMapping"

    @Controller
    @RequestMapping("/topicName")
    public class NotificationTestController {
    
        @NotificationSubscriptionMapping
        public void handleSubscriptionMessage(NotificationStatus status) throws IOException {
            //We subscribe to start receive the message
            status.confirmSubscription();
        }
    
        @NotificationMessageMapping
        public void handleNotificationMessage(@NotificationSubject String subject, @NotificationMessage String message) {
            // ...
        }
    
        @NotificationUnsubscribeConfirmationMapping
        public void handleUnsubscribeMessage(NotificationStatus status) {
            //e.g. the client has been unsubscribed and we want to "re-subscribe"
            status.confirmSubscription();
        }
    }
    

    http://cloud.spring.io/spring-cloud-aws/spring-cloud-aws.html#_sns_support

提交回复
热议问题