To utilize the RedisPubSubEventBusAdapter, you must install the "ioredis" package and supply a string serde, such as SuperJsonSerde.
import { RedisPubSubEventBusAdapter, SuperJsonSerde } from "@daiso-tech/core";import Redis from "ioredis";const dispatcherClient = new Redis("YOUR_REDIS_CONNECTION_STRING");const listenerClient = new Redis("YOUR_REDIS_CONNECTION_STRING");const serde = new SuperJsonSerde();const eventBusAdapter = new RedisPubSubEventBusAdapter({ dispatcherClient, listenerClient, serde,}); Copy
import { RedisPubSubEventBusAdapter, SuperJsonSerde } from "@daiso-tech/core";import Redis from "ioredis";const dispatcherClient = new Redis("YOUR_REDIS_CONNECTION_STRING");const listenerClient = new Redis("YOUR_REDIS_CONNECTION_STRING");const serde = new SuperJsonSerde();const eventBusAdapter = new RedisPubSubEventBusAdapter({ dispatcherClient, listenerClient, serde,});
The addListener method is used for adding listener for certain eventName.
The dispatch method is used for dispatching one or multiple events.
The removeListener method is used for removing listener for certain eventName.
To utilize the RedisPubSubEventBusAdapter, you must install the "ioredis" package and supply a string serde, such as SuperJsonSerde.
Example