Redis Workflow Engine Module
The Redis Workflow Engine Module uses Redis to track workflow executions and handle their subscribers. In production, it's recommended to use this module.
Register the Redis Workflow Engine Module#
Add the module into the modules property of the exported object in medusa-config.ts:
1import { Modules } from "@medusajs/framework/utils"2 3// ...4 5module.exports = defineConfig({6 // ...7 modules: [8 {9 resolve: "@medusajs/medusa/workflow-engine-redis",10 options: {11 redis: {12 redisUrl: process.env.WE_REDIS_URL,13 // ...other Redis options14 },15 },16 },17 ],18})
Environment Variables#
Make sure to add the following environment variables:
Redis Workflow Engine Module Options#
| Option | Description | Required |
|---|---|---|
| A string indicating the Redis connection URL. | No. If not provided, you must provide the |
| A string indicating the Redis connection URL. | No. If not provided, you must provide the |
| A connection object having the following properties:
| No. If not provided, you must provide the |
| The name of the queue used to keep track of retries and timeouts for workflow executions. Default: | No |
| The name of the queue used to keep track of retries and timeouts for scheduled jobs. Default: | No |
| An object of Redis options. Refer to the Redis API Reference for details on accepted properties. | No |
| An object of Redis options. Refer to the Redis API Reference for details on accepted properties. | No |
| An object of options to pass to all BullMQ instances. Refer to BullMQ's API reference for allowed properties. | No |
| An object of options to pass to all BullMQ worker instances. Refer to BullMQ's API reference for allowed properties. You can instead set options per worker using the | No |
| An object of options to pass to the main BullMQ queue instance for workflows. Refer to BullMQ's API reference for allowed properties. | No |
| An object of options to pass to the main BullMQ worker instance for workflows. Refer to BullMQ's API reference for allowed properties. | No |
| An object of options to pass to the main BullMQ workflow queue instance for scheduled jobs. Refer to BullMQ's API reference for allowed properties. | No |
| An object of options to pass to the main BullMQ workflow worker instance for scheduled jobs. Refer to BullMQ's API reference for allowed properties. | No |
| An object of options to pass to the BullMQ cleaner queue instance. Refer to BullMQ's API reference for allowed properties. | No |
| An object of options to pass to the BullMQ cleaner worker instance. 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 'workflow-engine-redis' established