Summary
This PR adds BullMQ queue and worker configuration options to the workflow-engine-redis module, bringing feature parity with the event-bus-redis module. It also introduces per-queue
configuration options for fine-grained control over the three internal queues (main, job, and cleaner).
Key changes:
- Added per-queue BullMQ configuration options (mainQueueOptions, jobQueueOptions, cleanerQueueOptions and their worker counterparts) with shared defaults
- Unified Redis option naming across modules: deprecated url → redisUrl, options → redisOptions (with backward compatibility)
- Moved configuration resolution to the loader and registered options in the DI container
- Added comprehensive JSDoc documentation for all configuration options
- Added unit tests for option merging and queue/worker configuration
Configuration Example
```ts
// Simple configuration - same options for all queues
{
redisUrl: "redis://localhost:6379",
queueOptions: { defaultJobOptions: { removeOnComplete: 1000 } },
workerOptions: { concurrency: 10 }
}
```
```ts
// Advanced configuration - per-queue overrides
{
redisUrl: "redis://localhost:6379",
workerOptions: { concurrency: 10 }, // shared default
jobWorkerOptions: { concurrency: 5 }, // override for scheduled workflows
cleanerWorkerOptions: { concurrency: 1 } // override for cleanup (low priority)
}
```
@medusajs/event-bus-redis
Documentation | Website
An open source composable commerce engine built for developers.
Overview
Redis Event Bus module for Medusa. When installed, the events system of Medusa is powered by BullMQ and io-redis. BullMQ is responsible for the message queue and worker. io-redis is the underlying Redis client, that BullMQ connects to for events storage.
Getting started
Install the module:
yarn add @medusajs/event-bus-redis
Add the module to your medusa-config.js:
module.exports = {
// ...
modules: [
{
resolve: "@medusajs/event-bus-redis",
options: {
redisUrl: "redis:..",
},
},
],
// ...
}
Configuration
The module can be configured with the following options:
| Option | Type | Description | Default |
|---|---|---|---|
redisUrl |
string |
URL of the Redis instance to connect to. | events-worker |
queueName |
string? |
Name of the BullMQ queue. | events-queue |
queueOptions |
object? |
Options for the BullMQ queue. See BullMQ's documentation. | {} |
redisOptions |
object? |
Options for the Redis instance. See io-redis's documentation |
{} |
Info: See how the options are applied in the RedisEventBusService and loader.
If you do not provide a redisUrl in the module options, the server will fail to start.