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:

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          url: process.env.WE_REDIS_URL,13        },14      },15    },16  ],17})

Environment Variables#

Make sure to add the following environment variables:

Terminal
WE_REDIS_URL=<YOUR_REDIS_URL>

Redis Workflow Engine Module Options#

OptionDescriptionRequiredDefault

url

A string indicating the Redis connection URL.

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

-

options

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

No

-

queueName

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

No

medusa-workflows

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.

-

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?
Edit this page