Skip to main content

Redis Events

Distributed event transport using Redis pub/sub, for deployments with multiple application instances. Payloads are JSON-serialized; connections are closed on platform shutdown via the adapter's shutdown() hook.

Requires the @redis/client peer dependency:

npm install @redis/client

Registration​

The Redis transport does not auto-register. Activate it with setEmitAdapter() before startPlatform (after registerBasePlugins()/registerAllPlugins(), which set the Node.js emitter):

import { setEmitAdapter } from '@unchainedshop/events';
import { RedisEventEmitter } from '@unchainedshop/plugins/events/redis';

setEmitAdapter(RedisEventEmitter());

Environment Variables​

VariableDefaultDescription
REDIS_HOST-Redis server hostname (required)
REDIS_PORT6379Redis server port
REDIS_DB0Redis database number

Adapter Details​

PropertyValue
ExportRedisEventEmitter
Sourceevents/redis.ts

For emitting and subscribing to events, see Event System.