You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,17 @@ public function handle(SnsMessageReceived $event)
41
41
```
42
42
The message content will always be a string. You are responsible for any deserialization or other steps required to interpret the message content.
43
43
44
+
### Dispatching specific events for specific ARNs
45
+
It is possible to map individual event classes to individual ARNs. The map is stored in the sns-handler.php config file (ensure this is published if it does not exist in your project). You can map either subscription events or message events in the following format:
Note that the map is parsed in order, so the first match found in the list will be the class dispatched.
54
+
Note that a default event class is not required, but if a matching event cannot be found in the map, a 404 will be returned if a message is sent using that ARN.
44
55
## Write a feature test to test the expected SNS feature
45
56
The ReceivesSnsMessagesTrait facilitates testing. Use the trait in your test
46
57
@@ -73,6 +84,11 @@ You can add your serialized message in the message field. Note that manually POS
73
84
This package adds a route to your application for incoming SNS requests. Note that because this is an api route, any API middleware you have applied in your application will affect this route. The route will be `{Your application's base URL}/api/sns/message`.
74
85
[Follow these instructions to subscribe your endpoint using HTTPS](https://docs.aws.amazon.com/sns/latest/dg/sns-http-https-endpoint-as-subscriber.html).
75
86
87
+
This package is configured to automatically respond to all SNS subscription requests sent to its endpoint. This can be disabled by adding the following to your .env file:
88
+
```
89
+
AUTO_CONFIRM_SUBSCRIPTIONS=false
90
+
```
91
+
76
92
**Note: You will only be able to subscribe your endpoint if it can be reached from the AWS SNS service**
if ($this->config->get('sns-handler.auto-confirm-subscriptions', true) === false) {
65
+
Log::info(sprintf('Subscription confirmation event not handled for topic %s with %s because auto-confirm-subscriptions disabled', $message->topicArn(), $className));
66
+
return;
67
+
}
64
68
$className::dispatch($message);
65
69
Log::info(sprintf('Dispatched confirmation event for subscription to topic %s with %s', $message->topicArn(), $className));
66
70
return;
@@ -73,7 +77,7 @@ public function handleRequest(SnsHttpRequest $request): void
0 commit comments