Subscriber
Base class for a gateway subscriber, binding this.core to the gateway Core.
abstract class Subscriber<
KeyOfSubscribers extends SubscriptionKey
> extends Subscriber<KeyOfSubscribers, Core>Member visibility
Filter class members by access level.
constructor
Constructs a new instance of the Subscriber class
Subscriber(payload: AllSubscriptions[Keys], core: TCore, key: Keys)Inherited from:Subscriber
KeyOfSubscribers
The subscription key or keys that this handler receives, the same ones as @Subscribe
KeyOfSubscribers extends SubscriptionKeycore
protected readonly core: TCoreInherited from:Subscriber
data
The published payload. It's never on a subscriber for several keys, where this.match reads it.
protected data: SingleKeyData<Keys>Inherited from:Subscriber
key
protected readonly key: KeysInherited from:Subscriber
logger
protected readonly logger: LoggerInherited from:Subscriber
execute()
Executes the subscriber handler logic.
Inherited from:Subscriber
match()
Run the case for the published key. Use this only when the subscriber is registered for several
keys. On a single-key subscriber, read this.data directly.
Provide one case per registered key. Each case receives that key's own payload. A missing key or an unknown key is a compile error.
protected async match<Ret, Cases>(
cases: OnlyCases<Cases, SubscriberMatchCases<Keys, Ret>>
): Promise<MatchResult<Ret, Cases>>RetThe type that every case must return. Leave it out to get the union of what the cases return.
Throws:
A SeedcordTypeError with MatchCaseMissing when the published key doesn't have a case.
Inherited from:Subscriber