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
- Classes
- Interfaces
- Structs
FifoQueue (preflight class)
No description
Constructor
new(props: FifoQueueProps?): FifoQueue
Properties
No properties
Methods
Signature | Description |
---|---|
inflight push(message: str, options: PushOptions): void | No description |
setConsumer(fn: inflight (str): void, options: SetConsumerOptions?): void | No description |
FifoQueue_sim (preflight class)
No description
Constructor
new(): FifoQueue_sim
Properties
No properties
Methods
Signature | Description |
---|---|
inflight push(message: str, options: PushOptions): void | No description |
setConsumer(handler: inflight (str): void, options: SetConsumerOptions?): void | No description |
FifoQueue_aws (preflight class)
No description
Constructor
new(props: FifoQueueProps?): FifoQueue_aws
Properties
No properties
Methods
Signature | Description |
---|---|
inflight push(message: str, options: PushOptions): void | No description |
setConsumer(handler: inflight (str): void, options: SetConsumerOptions?): void | No description |
IFifoQueue (interface)
No description
Properties
No properties
Methods
Signature | Description |
---|---|
inflight push(message: str, options: PushOptions): void | No description |
setConsumer(handler: inflight (str): void, options: SetConsumerOptions?): void | No description |
FifoQueueProps (struct)
No description
Properties
Name | Type | Description |
---|---|---|
dlq | DeadLetterQueueProps? | A dead-letter queue. |
retentionPeriod | duration? | How long a queue retains a message. |
timeout | duration? | How long a queue's consumers have to process a message. |
PushOptions (struct)
No description
Properties
Name | Type | Description |
---|---|---|
groupId | str | No description |
SetConsumerOptions (struct)
No description
Properties
Name | Type | Description |
---|---|---|
batchSize | num? | The maximum number of messages to send to subscribers at once. |
concurrency | num? | The maximum concurrent invocations that can run at one time. |
env |
| Environment variables to pass to the function. |
logRetentionDays | num? | Specifies the number of days that function logs will be kept. |
memory | num? | The amount of memory to allocate to the function, in MB. |
timeout | duration? | The maximum amount of time the function can run. |