Skip to main content

FIFO Queue

A wing library to work with FIFO (first-in first-out) Queues.

To use the queue, set groupId to group messages and process them in an ordered fashion.

Prerequisites

Installation

npm i @winglibs/fifoqueue

Usage

bring fifoqueue;

let queue = new fifoqueue.FifoQueue();

queue.setConsumer(inflight (message: str) => {
log("recieved message {message}");
});

test "will push to queue" {
queue.push("a new message", groupId: "myGroup");
}

License

This library is licensed under the MIT License.

API Reference

Table of Contents

FifoQueue (preflight class)

No description

Constructor

new(props: FifoQueueProps?): FifoQueue

Properties

No properties

Methods

SignatureDescription
inflight push(message: str, options: PushOptions): voidNo description
setConsumer(fn: inflight (str): void, options: SetConsumerOptions?): voidNo description

FifoQueue_sim (preflight class)

No description

Constructor

new(): FifoQueue_sim

Properties

No properties

Methods

SignatureDescription
inflight push(message: str, options: PushOptions): voidNo description
setConsumer(handler: inflight (str): void, options: SetConsumerOptions?): voidNo description

FifoQueue_aws (preflight class)

No description

Constructor

new(props: FifoQueueProps?): FifoQueue_aws

Properties

No properties

Methods

SignatureDescription
inflight push(message: str, options: PushOptions): voidNo description
setConsumer(handler: inflight (str): void, options: SetConsumerOptions?): voidNo description

IFifoQueue (interface)

No description

Properties

No properties

Methods

SignatureDescription
inflight push(message: str, options: PushOptions): voidNo description
setConsumer(handler: inflight (str): void, options: SetConsumerOptions?): voidNo description

FifoQueueProps (struct)

No description

Properties

NameTypeDescription
dlqDeadLetterQueueProps?A dead-letter queue.
retentionPeriodduration?How long a queue retains a message.
timeoutduration?How long a queue's consumers have to process a message.

PushOptions (struct)

No description

Properties

NameTypeDescription
groupIdstrNo description

SetConsumerOptions (struct)

No description

Properties

NameTypeDescription
batchSizenum?The maximum number of messages to send to subscribers at once.
concurrencynum?The maximum concurrent invocations that can run at one time.
env
Map?
Environment variables to pass to the function.
logRetentionDaysnum?Specifies the number of days that function logs will be kept.
memorynum?The amount of memory to allocate to the function, in MB.
timeoutduration?The maximum amount of time the function can run.