PHPackages                             mage-os/mageos-async-events - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mage-os/mageos-async-events

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

mage-os/mageos-async-events
===========================

An event-driven flexible async events module that allows you to process any event asynchronously.

v4.0.7(1mo ago)3018.7k—0%105MITPHPPHP &gt;=8.1CI passing

Since Jan 10Pushed 1mo ago9 watchersCompare

[ Source](https://github.com/mage-os/mageos-async-events)[ Packagist](https://packagist.org/packages/mage-os/mageos-async-events)[ RSS](/packages/mage-os-mageos-async-events/feed)WikiDiscussions 4.x Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (17)Used By (5)

Magento Asynchronous Events
===========================

[](#magento-asynchronous-events)

[![Integration Test](https://github.com/mage-os/mageos-async-events/actions/workflows/integration-tests.yml/badge.svg)](https://github.com/mage-os/mageos-async-events/actions/workflows/integration-tests.yml)[![REST](https://github.com/mage-os/mageos-async-events/actions/workflows/api-functional-tests.yml/badge.svg)](https://github.com/mage-os/mageos-async-events/actions/workflows/api-functional-tests.yml)

A framework for reliably handling asynchronous events with Magento.

- **Asynchronous**: The module uses RabbitMQ (or DB queues) to leverage asynchronous message delivery.
- **Flexible**: Decoupling events and dispatches provide greater flexibility in message modelling.
- **Scalable**: Handles back pressure and provides an asynchronous failover model automatically.

Installation
------------

[](#installation)

```
$ composer require mage-os/mageos-async-events
```

Install the module:

```
$ bin/magento setup:upgrade
```

Usage
-----

[](#usage)

### Define an asynchronous event

[](#define-an-asynchronous-event)

Create a new `async_events.xml` under a module's `etc/` directory.

```

```

### Create a Subscription

[](#create-a-subscription)

Tip

To view all available event sinks, check out [Async Event Sinks](https://github.com/mage-os/mageos-async-events-sinks)

#### HTTP

[](#http)

```
curl --location --request POST 'https://test.mageos.dev/rest/V1/async_event' \
--header 'Authorization: Bearer TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "asyncEvent": {
        "event_name": "sales.order.created",
        "recipient_url": "https://example.com/order_created",
        "verification_token": "supersecret",
        "metadata": "http"
    }
}'
```

#### Amazon EventBridge

[](#amazon-eventbridge)

Requires the [AWS Sinks](https://github.com/mage-os/mageos-async-events-aws) package

```
curl --location --request POST 'https://test.mageos.dev/rest/V1/async_event' \
--header 'Authorization: Bearer TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "asyncEvent": {
        "event_name": "sales.order.created",
        "recipient_url": "arn:aws:events:ap-southeast-2:ACCOUNT_ID:rule/BUS_NAME",
        "verification_token": "supersecret",
        "metadata": "eventbridge"
    }
}'
```

### Dispatch an asynchronous event

[](#dispatch-an-asynchronous-event)

```
use \MageOS\AsyncEvents\Model\AsyncEventPublisher;

// ...

public function __construct(private readonly AsyncEventPublisher $asyncEventPublisher) {}

public function execute(Observer $observer): void
{
    /** @var Order $order */
    $order = $observer->getData('order');

    // arguments are the inputs required by the service class in the asynchronous
    // event definition in async_events.xml
    // e.g: Magento\Sales\Api\OrderRepositoryInterface::get
    $message = ['id' => $order->getId()];

    $this->asyncEventPublisher->publish('sales.order.created', $message);
}
```

Ensure the following consumers are running

```
bin/magento queue:consumer:start event.trigger.consumer
bin/magento queue:consumer:start event.retry.consumer
```

Features
========

[](#features)

Trace
-----

[](#trace)

All events are logged at the individual subscription level with a UUID.

All information from the first delivery attempt to the latest attempt is presented as a trace table. The event payload is also available to view for investigation purposes.

[![Event Trace Page](docs/trace.png)](docs/trace.png)

Retries
-------

[](#retries)

Events are automatically retried with quadratic back off. The default retry limit is 5. The maximum backoff is 60 seconds.

Important

RabbitMQ is required for retries with back off. If you are using DB queues then quadratic back off is not available, and you will have to implement your own `\MageOS\AsyncEvents\Api\RetryManagementInterface`

The quadratic backoff is calculated as `min(60, pow($deathCount, 2));`

AttemptBackoff11 second24 seconds39 seconds416 seconds525 secondsTo change the default retry limit visit Admin &gt; Stores &gt; Settings &gt; Configuration &gt; Advanced &gt; System &gt; Async Events and update `Maximum Deaths`.

[![Retry Limit Config Page](docs/retry_limit_config.png)](docs/retry_limit_config.png)

Replays
-------

[](#replays)

An event can be replayed independent of its status. This is useful to debug or replay an event when all retries are exhausted.

Replays start a new chain of delivery attempts and will respect the same retry mechanism if they fail again.

Lucene Query Syntax
-------------------

[](#lucene-query-syntax)

All events are indexed in Elasticsearch by default. This allows you to search through events including the event payload!

The module supports [Lucene Query Syntax](https://lucene.apache.org/core/2_9_4/queryparsersyntax.html) to query event data like attributes.

The following attributes are available across all asynchronous events.

```
log_id
uuid
event_name
success
created

```

The following attributes differ between asynchronous event types.

```
data

```

### Examples

[](#examples)

Assuming you have the following events configured

```
customer.created
customer.updated
customer.deleted
sales.order.created
sales.invoice.created
shipment.created
shipment.updated
shipment.deleted

```

You can query all customer events by using a wildcard like `event_name: customer.*` which matches the following events

```
customer.created
customer.updated
customer.deleted

```

You can query all created events like `*.created` which matches the following events

```
customer.created
sales.order.created
sales.invoice.created
shipment.created

```

You can further narrow down using the other available attributes such as status or uuid.

The following query returns all customer events which have failed. `customer.* AND success: false`

You can combine complex lucene queries to fetch event history and then export them via the admin grid as a csv if you wish.

#### Searching inside event payloads

[](#searching-inside-event-payloads)

Searching an event payload depends on what event you are searching on.

For the following example event payload, four properties are indexed as attributes. Therefore, you can query on `data.customer_email`, `data.customer_firstname`, `data.customer_lastname` and `data.increment_id`. Properties inside array at any level are not searchable.

```
{
    "data": {
        "customer_email": "roni_cost@example.com",
        "customer_firstname": "Veronica",
        "customer_lastname": "Costello",
        "increment_id": "CK00000001",
        "payment_additional_info": [
            {
                "key": "method_title",
                "value": "Check / Money order"
            }
        ]
    }
}
```

Search all events where the customer email is `roni_cost@example.com`

`data.data.customer_email: roni_cost@example.com`

[![Lucene Example 1](docs/lucene_example_1.png)](docs/lucene_example_1.png)

Search all events with the order increment id starting with `CK` and status success

`data.data.increment_id: CK* AND success: true`

[![Lucene Example 2](docs/lucene_example_2.png)](docs/lucene_example_2.png)

To turn off asynchronous event indexing visit Admin &gt; Stores &gt; Settings &gt; Configuration &gt; Advanced &gt; System &gt; Async Events and disable `Enable Asynchronous Events Indexing`.

Support
-------

[](#support)

Async EventsMagento 2.3.x&gt;= Magento 2.4.0 &lt;= Magento 2.4.3&gt;= Magento 2.4.42.x✅✅❌3.x❌❌✅4.x❌❌✅

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance90

Actively maintained with recent releases

Popularity39

Limited adoption so far

Community28

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~57 days

Recently: every ~105 days

Total

15

Last Release

52d ago

Major Versions

v2.6.0-beta → v3.2.02024-01-10

v3.3.0 → v4.0.0-beta2024-04-27

3.x-dev → v4.0.12024-07-12

PHP version history (2 changes)2.x-devPHP &gt;=7.0

v3.2.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/100189073?v=4)[Mage-OS](/maintainers/mage-os-ci)[@mage-os-ci](https://github.com/mage-os-ci)

![](https://www.gravatar.com/avatar/b5df30b202c594ad4af9440fd694c0386b324e4045ca0aeeabb9b6125440e377?d=identicon)[gowrizrh](/maintainers/gowrizrh)

---

Top Contributors

[![gowrizrh](https://avatars.githubusercontent.com/u/40108018?v=4)](https://github.com/gowrizrh "gowrizrh (330 commits)")[![mage-os-ci](https://avatars.githubusercontent.com/u/100189073?v=4)](https://github.com/mage-os-ci "mage-os-ci (8 commits)")[![avstudnitz](https://avatars.githubusercontent.com/u/662059?v=4)](https://github.com/avstudnitz "avstudnitz (7 commits)")[![aligent-lturner](https://avatars.githubusercontent.com/u/40189797?v=4)](https://github.com/aligent-lturner "aligent-lturner (6 commits)")[![julienanquetil](https://avatars.githubusercontent.com/u/1108170?v=4)](https://github.com/julienanquetil "julienanquetil (2 commits)")[![Vinai](https://avatars.githubusercontent.com/u/72463?v=4)](https://github.com/Vinai "Vinai (2 commits)")[![Swahjak](https://avatars.githubusercontent.com/u/4386577?v=4)](https://github.com/Swahjak "Swahjak (1 commits)")

---

Tags

adobecommerceecommercemage-osmagentomagento2

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/mage-os-mageos-async-events/health.svg)

```
[![Health](https://phpackages.com/badges/mage-os-mageos-async-events/health.svg)](https://phpackages.com/packages/mage-os-mageos-async-events)
```

###  Alternatives

[yireo/magento2-webp2

Magento 2 module to add WebP support to the Magento frontend

2091.2M7](/packages/yireo-magento2-webp2)[tig/postnl-magento2

TIG Magento 2 PostNL extension

58544.2k4](/packages/tig-postnl-magento2)[lillik/magento2-price-decimal

Magento 2 Price Decimal Precision

111147.5k](/packages/lillik-magento2-price-decimal)[nosto/module-nostotagging

Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.

27659.1k4](/packages/nosto-module-nostotagging)[magepal/magento2-customeraccountlinksmanager

Customer Account Links Manager for Magento2 allows you to quickly and easily remove unwanted links from customer account dashboard

4084.9k](/packages/magepal-magento2-customeraccountlinksmanager)[doofinder/doofinder-magento2

Doofinder module for Magento 2

13204.0k1](/packages/doofinder-doofinder-magento2)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
