class RPCRedisBroker

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

RPC broker powered by Redis

Constructors

constructor(
redisClient: Redis
)

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>

protectedreadonly
redisClient : Redis

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

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
event: string
data: unknown
) : void

protected
listen() : Promise<void>

Begins polling for events, firing them to listen

Inherited from: BaseRedisBroker

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

Subscribes to the given events

Inherited from: BaseRedisBroker

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

Unsubscribes from the given events

Inherited from: BaseRedisBroker