RPCRedisBroker
RPC broker powered by Redis
declare class RPCRedisBroker<TEvents extends Record<string, any>, TResponses extends Record<keyof TEvents, any>> extends BaseRedisBroker<TEvents> implements IRPCBroker<TEvents, TResponses>
declare class RPCRedisBroker<TEvents extends Record<string, any>, TResponses extends Record<keyof TEvents, any>> extends BaseRedisBroker<TEvents> implements IRPCBroker<TEvents, TResponses>
Extends
BaseRedisBroker<TEvents>Implements
IRPCBroker<TEvents, TResponses>constructor(options)
Constructs a new instance of the
RPCRedisBroker
className | Type | Optional | Description |
---|---|---|---|
options | RPCRedisBrokerOptions | No | None |
listening
:
boolean
Whether this broker is currently polling eventsInherited from BaseRedisBroker
Readonly
Options this broker is using
Readonly
promises
:
Map<string, InternalPromise>
Readonly
STREAM_DATA_KEY
:
Used for Redis queues, see the 3rd argument taken by xaddInherited from BaseRedisBroker
Readonly
streamReadClient
:
Redis
Internal copy of the Redis client being used to read incoming payloadsInherited from BaseRedisBroker
Readonly
subscribedEvents
:
Set<string>
Events this broker has subscribed toInherited from BaseRedisBroker
call(event, data, timeoutDuration?)
:
Promise<TResponses[T]>
Makes an RPC call
Name | Type | Optional | Description |
---|---|---|---|
event | T | No | None |
data | TEvents[T] | No | None |
timeoutDuration | number | Yes | None |
destroy()
:
Promise<void>
Destroys the broker, closing all connectionsInherited from BaseRedisBroker
Protected
emitEvent(id, group, event, data)
:
void
Name | Type | Optional | Description |
---|---|---|---|
id | Buffer | No | None |
group | string | No | None |
event | string | No | None |
data | unknown | No | None |
Protected
listen(group)
:
Promise<void>
Begins polling for events, firing them to listen
Inherited from BaseRedisBroker
Name | Type | Optional | Description |
---|---|---|---|
group | string | No | None |
subscribe(group, events)
:
Promise<void>
Subscribes to the given events, grouping them by the given group name
Inherited from BaseRedisBroker
Name | Type | Optional | Description |
---|---|---|---|
group | string | No | None |
events | (keyof TEvents)[] | No | None |
unsubscribe(group, events)
:
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
Name | Type | Optional | Description |
---|---|---|---|
group | string | No | None |
events | (keyof TEvents)[] | No | None |