PHPackages                             aligent/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. aligent/async-events

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

aligent/async-events
====================

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

v3.1.7(1y ago)2915.6k↓37.5%5[2 issues](https://github.com/aligent/magento-async-events/issues)[1 PRs](https://github.com/aligent/magento-async-events/pulls)2MITPHPPHP &gt;=8.1

Since Feb 5Pushed 1y ago6 watchersCompare

[ Source](https://github.com/aligent/magento-async-events)[ Packagist](https://packagist.org/packages/aligent/async-events)[ RSS](/packages/aligent-async-events/feed)WikiDiscussions 3.x Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (40)Used By (2)

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

[](#magento-asynchronous-events)

[![Integration Test](https://github.com/aligent/magento-async-events/actions/workflows/integration-tests.yml/badge.svg)](https://github.com/aligent/magento-async-events/actions/workflows/integration-tests.yml)[![REST](https://github.com/aligent/magento-async-events/actions/workflows/api-functional-tests.yml/badge.svg)](https://github.com/aligent/magento-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.

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❌❌✅Installation
------------

[](#installation)

```
composer require aligent/async-events

```

Usage
-----

[](#usage)

### Define an asynchronous event

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

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

```

```

### Create Subscription

[](#create-subscription)

#### HTTP Subscription

[](#http-subscription)

```
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": "sales.order.created",
        "recipient_url": "https://example.com/order_created",
        "verification_token": "fD03@NpYbXYg",
        "metadata": "http"
    }
}'
```

#### Amazon EventBridge Subscription

[](#amazon-eventbridge-subscription)

Requires the [EventBridge Notifier](https://github.com/aligent/magento2-eventbridge-notifier)

```
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": "sales.order.created",
        "recipient_url": "arn:aws:events:ap-southeast-2:005158166381:rule/Test.EventBridge.Rule",
        "verification_token": "aIW0G9n3*9wN",
        "metadata": "event_bridge"
    }
}'
```

### Dispatch an asynchronous event

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

```
public function execute(Observer $observer): void
{
    /** @var Order $object */
    $object = $observer->getEvent()->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
    $arguments = ['id' => $object->getId()];
    $data = ['sales.order.created', $this->json->serialize($arguments)];

    $this->publisher->publish(
        QueueMetadataInterface::EVENT_QUEUE,
        $data
    );
}
```

Ensure the following consumers are running

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

Advanced Usage
--------------

[](#advanced-usage)

Refer to the [Wiki](https://github.com/aligent/magento-async-events/wiki)

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 exponential back off. The default retry limit is 5. The maximum backoff is 60 seconds.

The exponential 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`.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance47

Moderate activity, may be stable

Popularity37

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 97.8% 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 ~40 days

Recently: every ~103 days

Total

39

Last Release

379d ago

Major Versions

v2.4.1 → v3.0.22022-10-13

v2.4.2 → v3.1.02022-11-21

v2.5.1 → v3.1.12022-11-30

v2.5.2 → v3.1.22022-11-30

2.x-dev → v3.1.32023-03-15

PHP version history (3 changes)1.0.0PHP ~7.4.0

v2.2.0PHP &gt;=7.0

v3.0.0PHP &gt;=8.1

### Community

Maintainers

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

---

Top Contributors

[![gowrizrh](https://avatars.githubusercontent.com/u/40108018?v=4)](https://github.com/gowrizrh "gowrizrh (306 commits)")[![aligent-lturner](https://avatars.githubusercontent.com/u/40189797?v=4)](https://github.com/aligent-lturner "aligent-lturner (6 commits)")[![anthony-dinino-aligent](https://avatars.githubusercontent.com/u/98719916?v=4)](https://github.com/anthony-dinino-aligent "anthony-dinino-aligent (1 commits)")

---

Tags

asynchronouseventsmagentomagento2webhooks

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/aligent-async-events/health.svg)

```
[![Health](https://phpackages.com/badges/aligent-async-events/health.svg)](https://phpackages.com/packages/aligent-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)
