Skip to content

Commit

Permalink
Merge pull request #38 from run-as-root/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
cristiano-pacheco authored Feb 2, 2024
2 parents 46e188f + 9b3aa7d commit 1754c15
Show file tree
Hide file tree
Showing 59 changed files with 588 additions and 299 deletions.
Binary file added .DS_Store
Binary file not shown.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ utilizing The RabbitMQ's [dead letter exchange](https://www.rabbitmq.com/dlx.htm
- [How it works](#how-it-works)
- [Configuration](#configuration)
- [Skipping the retry](#skipping-the-retry)
- [Exploring a real scenario](#exploring-a-real-scenario)
- [License](#licence)

---
Expand Down Expand Up @@ -64,7 +65,7 @@ The default Magento's consumer behavior is to reject the message when an excepti
If you use a standard configuration for the queue (without a dead-letter exchange), the message will be discarded and not processed again.

This behavior will change a bit with this module. It will introduce an extra step that will check if the message has reached your retry limit,
if so, it will be discarded from RabbitMQ and sent to the `run_as_root_message` Mysql table and stay there until manual management through the admin panel.
if so, it will be discarded from RabbitMQ and sent to the `run_as_root_queue_error_message` Mysql table and stay there until manual management through the admin panel.

If the message has not reached the retry limit, it will be rejected, and RabbitMQ will send it to the dead letter exchange. The message will be routed automatically to the "delay" queue and stay there until de TTL time is reached.
After the TTL time is reached, the message will be returned to its original queue.
Expand Down Expand Up @@ -203,6 +204,10 @@ System > Configuration > RUN-AS-ROOT > Message Queue Retry

![img.png](docs/module-configuration.png)

**Note:** The configuration `Total of days to keep the messages` is the period that the messages will stay in the database. After this period, the messages will be deleted automatically by a Cron job.

The `run_as_root_clean_old_queue_error_messages` cron job is scheduled to run every day at 02:00 AM.

---

### Skipping the retry
Expand All @@ -219,5 +224,11 @@ For more information of how to configure message queues in Magento 2, you can ta

---

## Exploring a real scenario

If you want to know more about this module and explore a real scenario with it, please, take a look at the [blog post](https://dev.to/run_as_root/preventing-transaction-loss-unleashing-the-power-of-resilient-transactions-with-rabbitmq-dead-letter-exchanges-in-magento-2-8h0) we wrote about it.

---

## License
[MIT](https://opensource.org/licenses/MIT)
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"sniffer": "vendor/bin/phpcs --colors -p ./src --standard=phpcs-ruleset.xml",
"fix-style": "vendor/bin/phpcbf --colors -p ./src --standard=phpcs-ruleset.xml",
"sniffer:php8.1": "vendor/bin/phpcs -p ./src --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 8.1",
"sniffer:php8.2": "vendor/bin/phpcs -p ./src --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 8.2",
"mess-detector": "vendor/bin/phpmd src html phpmd-ruleset.xml --exclude \"Test\" --strict --reportfile reports/phpmd/phpmd.html"
}
}
Loading

0 comments on commit 1754c15

Please sign in to comment.