Skip to main content
Version: v2

Class: SubscriptionService

Constructors#

constructor#

• new SubscriptionService()

Defined in#

src/service/subscription.ts:23

Properties#

defaultSubscriberOptions#

â–ª Static defaultSubscriberOptions: SubscriberOptions

All subscriptions will inherit from this default options object

Defined in#

src/service/subscription.ts:21


subscribers#

â–ª Static subscribers: SubscriberObject<any>[] = []

Defined in#

src/service/subscription.ts:14

Methods#

closeAll#

â–¸ Static closeAll(): Promise<void>

Call this function from a process exit handler to close all current subscriptions

Returns#

Promise<void>

Defined in#

src/service/subscription.ts:64


getSubscribers#

â–¸ Static getSubscribers(): Subscribers

Returns#

Subscribers

Defined in#

src/service/subscription.ts:68


handleError#

â–¸ Static handleError(err, metadata): void

If passed, it would serve as the default error handler for all subscriptions. Applications should override this with custom error handling: log error, cleanup resources and exit the process. Default logs the error and rethrows

Parameters#

NameType
errError
metadataSubscriberMetadata

Returns#

void

Defined in#

src/service/subscription.ts:51


init#

â–¸ Static init(): Promise<void>

Can be used to initialize process level globals (like DB Connections). Default is a no-op

Returns#

Promise<void>

Defined in#

src/service/subscription.ts:42


loadSubscriptionService#

â–¸ Static loadSubscriptionService(): typeof SubscriptionService

Returns#

typeof SubscriptionService

Defined in#

src/service/subscription.ts:112