Skip to main content

Class: EventRepublisher<SourceEvents, TargetEvents>

Defined in: src/sdk/data/EventRepublisher.ts:14

Republishes event bus topics.

Type Parameters​

Type Parameter
SourceEvents
TargetEvents

Constructors​

Constructor​

new EventRepublisher<SourceEvents, TargetEvents>(bus): EventRepublisher<SourceEvents, TargetEvents>

Defined in: src/sdk/data/EventRepublisher.ts:27

Constructor.

Parameters​

ParameterTypeDescription
busEventBusThe event bus.

Returns​

EventRepublisher<SourceEvents, TargetEvents>

Methods​

clearRepublishes()​

clearRepublishes(): void

Defined in: src/sdk/data/EventRepublisher.ts:121

Clears all republishes from this publisher.

Returns​

void


startRepublish()​

Call Signature​

startRepublish<Source, Target>(sourceTopic, targetTopic, sync, cache): number

Defined in: src/sdk/data/EventRepublisher.ts:39

Starts republishing data from a source topic to a target topic. Republishing will begin as soon as the target topic has at least one subscriber, or immediately if the target topic data is synced across instruments.

Type Parameters​
Type Parameter
Source extends string
Target extends string | number | symbol
Parameters​
ParameterTypeDescription
sourceTopicSourceThe source topic.
targetTopicTargetThe target topic.
syncbooleanWhether the target topic should be synced across instruments.
cachebooleanWhether the target topic data should be cached.
Returns​

number

A unique ID associated with the republish.

Call Signature​

startRepublish<Source, Target>(sourceTopic, targetTopic, sync, cache, map): number

Defined in: src/sdk/data/EventRepublisher.ts:59

Starts republishing data from a source topic to a target topic after the data has been transformed by a mapping function. Republishing will begin as soon as the target topic has at least one subscriber, or immediately if the target topic data is synced across instruments.

Type Parameters​
Type Parameter
Source extends string
Target extends string
Parameters​
ParameterTypeDescription
sourceTopicSourceThe source topic.
targetTopicTargetThe target topic.
syncbooleanWhether the target topic should be synced across instruments.
cachebooleanWhether the target topic data should be cached.
map(sourceData) => TargetEvents[Target]A mapping function to use to transform the source data.
Returns​

number

A unique ID associated with the republish.


stopRepublish()​

stopRepublish(id): boolean

Defined in: src/sdk/data/EventRepublisher.ts:105

Stops a republish handled by this publisher.

Parameters​

ParameterTypeDescription
idnumberThe unique ID associated with the republish to stop.

Returns​

boolean

Whether the requested republish was stopped.