rabbitevents/deduplication
A Laravel package that adds deduplication to RabbitEvents, helping prevent duplicate RabbitMQ messages from being processed more than once. It provides a simple layer for idempotent event handling and safer consumers.
composer require rabbitevents/deduplication — this pulls in rabbitevents/listener ^10.0, so confirm you are already on the 10.x listener before installing; on 9.x you get the package but no deduplication, because 9.x-published messages carry no ID.config/cache.php. Pick an existing store that every worker of the queue can reach (redis, database, or memcached) and point the package at it with RABBITEVENTS_DEDUPLICATION_STORE. Nothing else to configure — no RabbitMQ plugin, no migration, no queue declaration changes.RABBITEVENTS_DEDUPLICATION_STORE must be present in the environment of every consumer process, not just the web app. Set it in .env, in the supervisor/ECS/K8s env for consumers, and in config/ if you resolve it at config-cache time.ack, and confirm the second delivery is skipped.upsert / "already processed" check inside listeners with real side effects (payments, emails, webhooks).database only if you accept a write per message in your primary DB and have the cache table migrated.array store) so assertions about "handled twice" are deterministic and don't leak between tests. Assert both directions: a redelivered-after-success message is skipped, and a redelivered-after-failure message still runs.config/cache.php stops the worker at start. This is the loudest failure mode and the one most likely to bite on first deploy — commonly because RABBITEVENTS_DEDUPLICATION_STORE names a connection that exists in .env but not in a config-cached config/cache.php, or names a database store whose migration never ran. Check php artisan config:cache behaviour in the deploy pipeline after setting the variable.file, array, or any node-local cache gives each worker its own view, so deduplication only works when the same worker happens to get the redelivery. The config will not stop you; the release notes only require "shared".orders and analytics is handled once in each queue. If your listener writes to a shared resource from both queues, that is a business-level duplicate and deduplication won't hide it.allkeys-lru, short TTLs), a late redelivery may no longer find its marker and will be handled again. Size the store for your redelivery window and avoid mixing it with volatile caches.How can I help you explore Laravel packages today?