class PubSubRedisBroker

implements

IPubSubBroker<TEvents>

extends

BaseRedisBroker<TEvents>
export declare class PubSubRedisBroker<TEvents extends Record<string, any>> extends BaseRedisBroker<TEvents> implements IPubSubBroker<TEvents>

PubSub broker powered by Redis

Type Parameters

TEvents extends Record<string, any>

protected
listening : boolean

Whether this broker is currently polling events

Inherited from: BaseRedisBroker

protectedreadonly
options : Required<RedisBrokerOptions>

Options this broker is using

Inherited from: BaseRedisBroker

staticreadonly
STREAM_DATA_KEY :

Used for Redis queues, see the 3rd argument taken by xadd

Inherited from: BaseRedisBroker

protectedreadonly
streamReadClient : Redis

Internal copy of the Redis client being used to read incoming payloads

Inherited from: BaseRedisBroker

protectedreadonly
subscribedEvents : Set<string>

Events this broker has subscribed to

Inherited from: BaseRedisBroker

destroy() : Promise<void>

Destroys the broker, closing all connections

Inherited from: BaseRedisBroker

protected
emitEvent(
id: Buffer
group: string
event: string
data: unknown
) : void

protected
listen(
group: string
) : Promise<void>

Begins polling for events, firing them to listen

Inherited from: BaseRedisBroker

publish<

Event extends keyof TEvents

>(
event: Event
data: TEvents[Event]
) : Promise<void>

Publishes an event

subscribe(
group: string
events: (keyof TEvents)[]
) : Promise<void>

Subscribes to the given events, grouping them by the given group name

Inherited from: BaseRedisBroker

unsubscribe(
group: string
events: (keyof TEvents)[]
) : Promise<void>

Unsubscribes from the given events - it's required to pass the same group name as when subscribing for proper cleanup

Inherited from: BaseRedisBroker