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.

Using Cloud? Our Cloud offering automatically provisions a Redis instance and configures the Redis Workflow Engine Module for you. Learn more in the Redis Cloud documentation.

Register the Redis Workflow Engine Module#

Add the module into the modules property of the exported object in medusa-config.ts:

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:

Terminal
WE_REDIS_URL=<YOUR_REDIS_URL>

Redis Workflow Engine Module Options#

OptionDescriptionRequired

url (Deprecated v2.12.2+, use redisUrl instead)

A string indicating the Redis connection URL.

No. If not provided, you must provide the pubsub option.

redisUrl (v2.12.2+)

A string indicating the Redis connection URL.

No. If not provided, you must provide the pubsub option.

pubsub

A connection object having the following properties:

  • url: A required string indicating the Redis connection URL.
  • options: An optional object of Redis options. Refer to the Redis API Reference for details on accepted properties.

No. If not provided, you must provide the url option.

queueName

The name of the queue used to keep track of retries and timeouts for workflow executions.

Default: medusa-workflows

No

jobQueueName

The name of the queue used to keep track of retries and timeouts for scheduled jobs.

Default: medusa-workflows-jobs

No

options (deprecated v2.12.2+, use redisOptions instead)

An object of Redis options. Refer to the Redis API Reference for details on accepted properties.

No

redisOptions (v2.12.2+)

An object of Redis options. Refer to the Redis API Reference for details on accepted properties.

No

queueOptions (v2.12.2+)

An object of options to pass to all BullMQ instances. Refer to BullMQ's API reference for allowed properties.

No

workerOptions (v2.12.2+)

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 mainWorkerOptions, jobWorkerOptions, and cleanerWorkerOptions options.

No

mainQueueOptions (v2.12.2+)

An object of options to pass to the main BullMQ queue instance for workflows. Refer to BullMQ's API reference for allowed properties.

No

mainWorkerOptions (v2.12.2+)

An object of options to pass to the main BullMQ worker instance for workflows. Refer to BullMQ's API reference for allowed properties.

No

jobQueueOptions (v2.12.2+)

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

jobWorkerOptions (v2.12.2+)

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

cleanerQueueOptions (v2.12.2+)

An object of options to pass to the BullMQ cleaner queue instance. Refer to BullMQ's API reference for allowed properties.

No

cleanerWorkerOptions (v2.12.2+)

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
Was this page helpful?
Ask Anything
Ask any questions about Medusa. Get help with your development.
You can also use the Medusa MCP server in Cursor, VSCode, etc...
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break