class RPCRedisBroker

implements

IRPCBroker<TEvents, TResponses>

extends

BaseRedisBroker<TEvents>
export declare class RPCRedisBroker<TEvents extends Record<string, any>, TResponses extends Record<keyof TEvents, any>> extends BaseRedisBroker<TEvents> implements IRPCBroker<TEvents, TResponses>

RPC broker powered by Redis

Constructors

constructor()

Constructs a new instance of the RPCRedisBroker class

Type Parameters

TEvents extends Record<string, any>

TResponses extends Record<keyof TEvents, any>

protected
listening : boolean

Whether this broker is currently polling events

Inherited from: BaseRedisBroker

protectedreadonly
options : Required<RPCRedisBrokerOptions>

Options this broker is using

protectedreadonly
promises : Map<string, InternalPromise>

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

call<

Event extends keyof TEvents

>(
event: Event
data: TEvents[Event]
timeoutDuration?: number
) : Promise<TResponses[Event]>

Makes an RPC call

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

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