Amazon Simple Notification Service
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
This module allows a Drupal site to respond to Amazon SNS notifications. For example, perhaps some upstream system is processing a long job and the Drupal site needs to update entity data when it's done. Instead of being forced to poll with queues and use a background Drush command, SNS can instead push a notification to Drupal. Each SNS message triggers a
Symfony Event that other modules or custom code can respond to. SNS itself handles redelivery and failure logging.
As this module requires the AWS SDK, sites using this module will need to use Composer to grab it and all other dependencies.
This module implements it's own API as an example for other modules. To learn how to create your own event subscribers, see amazon_sns.services.yml and Drupalamazon_snsEventSnsSubscriptionConfirmationSubscriber.
Setting up a subscription
This module expects all SNS notifications to be sent to /_amazon-sns/notify. To test basic functionality, you can create an SNS topic and send a test message using the Amazon Web Services console.
- Log in to AWS and open the SNS dashboard.
- Under
Common Actions, create a topic. - In the topic, click
Create subscription.- Select HTTP or HTTPS as the protocol.
- Enter
https://example.com/_amazon-sns/notifyas the endpoint. The URL
must be accessible to Amazon for SNS to work. Consider setting up a proxy
like ngrok or requestb.in for local environments or additional logging. - After saving, there should be a subscription confirmation logged in Drupal's logs.
- Use
Publish to Topicto send a test message. The message will be logged. You're ready to write any custom code needed to react to the notification.
