Skip to content

Commit

Permalink
Merge pull request #8 from aligent/chore/update-readme
Browse files Browse the repository at this point in the history
Update README
  • Loading branch information
gowrizrh authored Aug 10, 2022
2 parents ef4c115 + 277f09d commit f8414df
Showing 1 changed file with 12 additions and 27 deletions.
39 changes: 12 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,29 @@
# Magento 2 Eventbridge Notifier

This repository adds an [aligent/async-events](https://github.com/aligent/magento-async-events) compatible notifier for submitting events to [Amazon EventBridge](https://aws.amazon.com/eventbridge/).

## How to use
This module only provides an implementation of the `EventBridgeNotifier`. The `NotifierFactoryInterface` does not know anything about it yet. Therefore, it must be hooked up to the factory depending on the implementation of the `NotifierFactory`.
## Getting Started

1. Hook the notifier to the notifier factory
* This depends on how your factory is setup, if you're using the reference implementation for `NotifierFactoryInterface`, then you have to add the following lines
to a `di.xml`
### Configure AWS Credentials
An IAM role with the `events:PutEvents` action is required so that the notifier can relay events into Amazon EventBridge.

```xml
<type name="Aligent\AsyncEvents\Service\AsyncEvent\NotifierFactory">
<arguments>
<argument name="notifierClasses" xsi:type="array">
<item name="event_bridge" xsi:type="object">Aligent\EventBridge\Service\EventBridgeNotifier</item>
</argument>
</arguments>
</type>
```
2. Run `bin/magento cache:clear`
3. Create subscribers which use the new notifier using the `metadata` field.
Under `Stores -> Services -> Amazon EventBridge` set the `Access Key ID` and the `Secret Access Key` and the `Region`. You
can configure the source of the event and the event bus if necessary.

![AWS Config](./docs/config.png)

### Create Subscription

Example
```sh
```shell
curl --location --request POST 'https://m2.dev.aligent.consulting:44356/rest/V1/async_event' \
--header 'Authorization: Bearer TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"asyncEvent": {
"event_name": "my.custom.hook",
"event_name": "example.event",
"recipient_url": "Amazon Event Bridge ARN",
"verification_token": "supersecret",
"metadata": "event_bridge"
}
}'
```

### Configuring AWS Credentials
An IAM role with the `events:PutEvents` action is required so that the notifier can relay events into Amazon EventBridge.

Under `Stores -> Services -> Amazon EventBridge` set the `Access Key ID` and the `Secret Access Key` and the `Region`. You
can configure the source of the event and the event bus if necessary.

![AWS Config](./docs/config.png)

0 comments on commit f8414df

Please sign in to comment.