Skip to content
Mykhailo Stadnyk edited this page Mar 18, 2020 · 28 revisions

@imqueue/pg-pubsub

Index

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

AnyJson

Ƭ AnyJson: boolean | number | string | null | JsonArray | JsonMap

Represents any JSON-serializable value


JsonArray

Ƭ JsonArray: AnyJson[]

Represents JSON-serializable array

Variables

Const ACQUIRE_INTERVAL

ACQUIRE_INTERVAL: 30000 = 30000


Const DefaultOptions

DefaultOptions: PgPubSubOptions = Object.freeze({ retryLimit: RETRY_LIMIT, retryDelay: RETRY_DELAY, singleListener: IS_ONE_PROCESS, acquireInterval: ACQUIRE_INTERVAL, filtered: false, })

Hard-coded pre-set of PgPubSubOptions

see PgPubSubOptions


Const IS_ONE_PROCESS

IS_ONE_PROCESS: true = true


Const RETRY_DELAY

RETRY_DELAY: 100 = 100


Const RETRY_LIMIT

RETRY_LIMIT: number = Infinity


Const RX_LOCK_CHANNEL

RX_LOCK_CHANNEL: RegExp‹› = new RegExp(^__${PgIpLock.name}__:)


Const SCHEMA_NAME

SCHEMA_NAME: "pgip_lock" = "pgip_lock"


Const SHUTDOWN_TIMEOUT

SHUTDOWN_TIMEOUT: 500 = 500


Timeout

Timeout: any


Let timer

timer: any

Functions

pack

pack(input: AnyJson, logger?: AnyLogger, pretty: boolean): string

Serializes given input object to JSON string. On error will return serialized null value

Parameters:

Name Type Default Description
input AnyJson - serializable value
logger? AnyLogger - -
pretty boolean false -

Returns: string


stringify

stringify(input: AnyJson, pretty?: undefined | false | true): string

Performs JSON.stringify on a given input taking into account pretty flag.

access private

Parameters:

Name Type Description
input AnyJson serializable value
pretty? undefined | false | true -

Returns: string


terminate

terminate(): Promise‹void›

Performs graceful shutdown of running process releasing all instantiated locks and properly destroy all their instances.

Returns: Promise‹void›


unpack

unpack(input?: undefined | string, logger?: AnyLogger): AnyJson

Deserializes given input JSON string to corresponding JSON value object. On error will return empty object

Parameters:

Name Type Description
input? undefined | string string to deserialize
logger? AnyLogger -

Returns: AnyJson

Clone this wiki locally