DBQueueClient

module:queue. DBQueueClient

Queue client using a database for persistence, this driver uses naive content resolution method by SELECT first and then UPDATE received record with new visibilityTimeout, this relies on the database to atomically perform conditional UPDATE, if no record updated it is ignored and performs SELECT again.

This is not supposed to be used in production but only for development without external tools like AWS, Redis.

It supports the same behaviour as Redis/SQS clients regarding visibilityTimeout.

To create bk_queue table run as:

bksh -db-create-tables -queue-default db://

Constructor

new DBQueueClient(options)

Source:
Parameters:
Name Type Description
options object
Properties
Name Type Attributes Description
count int <optional>

config property specifies how messages to process at the same time, default is 1.

interval int <optional>

config property defines in ms how often to check for new messages after processing a message, i.e. after a messages processed it can poll immediately or after this amount of time, default is 3000 milliseconds.

retryInterval int <optional>

config property defines in ms how often to check for new messages after an error or no data, i.e. on empty pool when no messages are processed it can poll immediately or after this amount of time, default is 5000 mulliseconds.

visibilityTimeout int <optional>

property specifies how long the messages being processed stay hidden, in milliseconds.

timeout int <optional>

property defines how long to wait for new messages, i.e. the long poll, in milliseconds

startTime int <optional>

property which is the time in the future when a message must be actually processed there, The scheduling is implemented using AWS visibilityTimeout feature, keep scheduled messages hidden until the actual time.

Example
queue-messages = db://?bk-pool=dynamodb
queue-store = db://?bk-pool=pg&bk-visibilityTimeout=300&bk-count=2