Local Event Bus Module

The Local Event Bus Module uses Node EventEmitter to implement Medusa's pub/sub events system. The Node EventEmitter is limited to a single process environment.

This module is useful for development and testing, but it’s not recommended to be used in production.

For production, it’s recommended to use modules like Redis Event Bus Module.


Register the Local Event Bus Module#

NoteThe Local Event Bus Module is registered by default in your application.

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/event-bus-local",10    },11  ],12})

Test the Module#

To test the module, start the Medusa application:

You'll see the following message in the terminal's logs:

Terminal
Local Event Bus installed. This is not recommended for production.
Was this page helpful?
Edit this page