Amazon Simple Notification Service
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 \Drupal\amazon_sns\Event\SnsSubscriptionConfirmationSubscriber.
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.
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 8.x-1.3 | Stable | Drupal 11 compatibility | Jan 9, 2025 |