- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
Redis Event Bus Module
The Redis Event Bus Module uses Redis to implement Medusa's pub/sub events system.
It's powered by BullMQ and io-redis
. BullMQ is responsible for the message queue and worker, and io-redis
is the underlying Redis client that BullMQ connects to for events storage.
In production, it's recommended to use this module.
Register the Redis Events Bus Module#
Add the module into the modules
property of the exported object in medusa-config.ts
:
Environment Variables#
Make sure to add the following environment variables:
Redis Event Bus Module Options#
Option | Description | Required | Default |
---|---|---|---|
| A string indicating the Redis connection URL. | Yes | - |
| An object of Redis options. Refer to the Redis API Reference for details on accepted properties. | No | - |
| A string indicating BullMQ's queue name. | No |
|
| An object of options to pass to the BullMQ constructor. Refer to BullMQ's API reference for allowed properties. | No | - |
| An object of options to pass to the BullMQ Worker constructor. Refer to BullMQ's API reference for allowed properties. | No | - |
| An object of options to pass to jobs added to the BullMQ queue. Refer to BullMQ's API reference for allowed properties. | No | - |
Test the Module#
To test the module, start the Medusa application:
You'll see the following message in the terminal's logs:
Terminal❯Connection to Redis in module 'event-redis' established