Skip to content
Mykhailo Stadnyk edited this page Nov 30, 2020 · 28 revisions

Globals

@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

ACQUIRE_INTERVAL

Const ACQUIRE_INTERVAL: 30000 = 30000


DefaultOptions

Const 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


IS_ONE_PROCESS

Const IS_ONE_PROCESS: true = true


RETRY_DELAY

Const RETRY_DELAY: 100 = 100


RETRY_LIMIT

Const RETRY_LIMIT: number = Infinity


RX_LOCK_CHANNEL

Const RX_LOCK_CHANNEL: RegExp = new RegExp(`^(__${PgIpLock.name}__:)+`)


SCHEMA_NAME

Const SCHEMA_NAME: string = process.env.PG_PUBSUB_SCHEMA_NAME || 'pgip_lock'


SHUTDOWN_TIMEOUT

Const SHUTDOWN_TIMEOUT: number = +( process.env.PG_PUBSUB_SHUTDOWN_TIMEOUT || 1000)


Timeout

Timeout: any


timer

Let 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 value 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