PostgresQueueParameters
Class: PostgresQueueParameters
Defined in: postgres/src/postgresqueue.service.ts:11
Configuration for PostgresQueueService.
Extends
QueueParameters
Constructors
Constructor
new PostgresQueueParameters():
PostgresQueueParameters
Returns
PostgresQueueParameters
Inherited from
QueueParameters.constructor
Properties
autoCreateTable?
optionalautoCreateTable?:boolean
Defined in: postgres/src/postgresqueue.service.ts:60
Whether to auto-create the queue table on init.
Default
true
batchSize?
optionalbatchSize?:number
Defined in: postgres/src/postgresqueue.service.ts:39
Max number of messages pulled per receiveMessage call. The queue
worker calls receiveMessage in a loop, so this is also the parallel
batch size.
Default
10
idleDelayer?
optionalidleDelayer?:WaitDelayerDefinition
Defined in: core/lib/queues/queueservice.d.ts:47
Delayer between two receives of the main consumer while the queue returns no message
Queues answering immediately when empty (PostgresQueue, AMQPQueue...) would otherwise be polled in a tight
loop. The delay grows with the consecutive empty receives, up to maxIdleDelay; the time spent in the receive
is deducted, so long-polling queues (SQSQueue, FileQueue, MemoryQueue with a timeout) are not slowed down.
Default
{ "type": "exponential", "interval": 50 }
Inherited from
QueueParameters.idleDelayer
maxConsumers
maxConsumers:
number
Defined in: core/lib/queues/queueservice.d.ts:37
Max number of queue consumers Queue will auto increase to this max number if queue is loaded and it will decrease to just one consumer if no messages are available
Default
10
Inherited from
QueueParameters.maxConsumers
maxIdleDelay?
optionalmaxIdleDelay?:number
Defined in: core/lib/queues/queueservice.d.ts:56
Maximum delay between two receives while the queue stays empty, in milliseconds
It bounds the extra latency of the first message after an idle period, and the polling rate of an idle consumer (4 receives per second at 250ms).
Default
250
Inherited from
QueueParameters.maxIdleDelay
notify?
optionalnotify?:boolean
Defined in: postgres/src/postgresqueue.service.ts:70
Wake up the consumers with LISTEN / NOTIFY instead of polling
sendMessage NOTIFYs a channel named after the table (lowercased), and consume() opens a dedicated
LISTEN connection: once the queue is empty, its receives wait for a notification, up to waitTimeout,
before querying again. Direct receiveMessage calls never wait. Set to false to poll as before.
Default
true
postgresqlServer?
optionalpostgresqlServer?:ClientConfig|PoolConfig
Defined in: postgres/src/postgresqueue.service.ts:54
Connection settings forwarded to the chosen pg client/pool. Defaults to PG* environment variables.
Can be encrypted with webda config encrypt
Secret
password,connectionString
reconnectDelay?
optionalreconnectDelay?:number
Defined in: postgres/src/postgresqueue.service.ts:86
Reconnect delay in milliseconds when the LISTEN connection drops. A randomized jitter is added. Consumers poll while it is down.
Default
500
table?
optionaltable?:string
Defined in: postgres/src/postgresqueue.service.ts:22
Table name backing the queue. Auto-created on init if missing.
Default
"webda_queue"
Pattern
/^[a-zA-Z_][a-zA-Z0-9_]*$/
Examples
"myapp_queue"
"user_notifications"
"cache_invalidation"
"orders"
type
type:
string
Defined in: core/lib/services/serviceparameters.d.ts:9
Type of the service
Inherited from
QueueParameters.type
usePool?
optionalusePool?:boolean
Defined in: postgres/src/postgresqueue.service.ts:46
Whether to use a pg.Pool (recommended for shared workloads) or a
single pg.Client.
Default
true
visibilityTimeout?
optionalvisibilityTimeout?:number
Defined in: postgres/src/postgresqueue.service.ts:31
Visibility timeout in seconds — how long a locked-but-undeleted message stays invisible to other consumers before being eligible for redelivery. Workers that crash mid-process without acking will see their messages reappear after this window.
Default
30
waitTimeout?
optionalwaitTimeout?:number
Defined in: postgres/src/postgresqueue.service.ts:79
Maximum time a receive of consume() waits for a notification, in seconds
The queue is queried at least that often, and at least every visibilityTimeout, as a safety net: it
picks up the messages whose visibility lock expired, and the ones whose notification was missed.
Default
20
workerDelayer?
optionalworkerDelayer?:WaitDelayerDefinition
Defined in: core/lib/queues/queueservice.d.ts:24
Delayer between two failed attempts to process messages
Inherited from
QueueParameters.workerDelayer
workerParallelism
workerParallelism:
boolean
Defined in: core/lib/queues/queueservice.d.ts:29
Define if worker should process multi message received in //
Default
true
Inherited from
QueueParameters.workerParallelism
Methods
load()
load(
params?):this
Defined in: postgres/src/postgresqueue.service.ts:93
Parameters
params?
any = {}
the input parameters
Returns
this
this
Overrides
QueueParameters.load
update()
update(
params,delta):this
Defined in: core/lib/application/parameters.d.ts:21
Update parameters and call watchers if a parameter was changed
Parameters
params
any
the service parameters
delta
any
the delta
Returns
this
this for chaining
Inherited from
QueueParameters.update
with()
with(
callback):this
Defined in: core/lib/application/parameters.d.ts:27
Watch for changes on the parameters and call watchers when a parameter is changed
Parameters
callback
(params) => void
the callback function
Returns
this
this for chaining
Inherited from
QueueParameters.with