Options
All
  • Public
  • Public/Protected
  • All
Menu

sqess

A wrapper around SQS

Complete Documentation


Install

npm install --save sqess

# Or, if you fancy
yarn add sqess

Usage

Basic usage is as follows, check out the complete documentation if you feel so inclined.

import Queue from 'sqess';

async function main() {

  // Initializes the sqess instance but doesn't create the queue
  const queue = new Queue({
    queueName: 'test-queue-1',
    handler: async (queueItem) => Promise.resolve(true),
    onFinish: () => true,
  });

  // Actually creates the queue
  await queue.create();

  // Fill that queue up
  await queue.fill([/* Either a single item or an array of items */]);

  // Process queue items until there's no tomorrow
  await queue.process();
}

main();

Index

Type aliases

QueueHandler

QueueHandler: function

The handler will be invoked with each item from the queue (or with an array of queue items if QueueConfig.batchSize is specified) and should return a Promise.

Type declaration

    • (queueItem: string | string[]): Promise<void>
    • Parameters

      • queueItem: string | string[]

      Returns Promise<void>

Variables

AWS_ACCESS_KEY_ID

AWS_ACCESS_KEY_ID: string

AWS_DEFAULT_REGION

AWS_DEFAULT_REGION: string

AWS_SECRET_ACCESS_KEY

AWS_SECRET_ACCESS_KEY: string

Const STANDARD_QUEUE_NAME_MATCHER

STANDARD_QUEUE_NAME_MATCHER: RegExp = /^[a-zA-Z0-9_-]{1,80}$/

Matches against valid standard queue names. The only valid non-standard queue names belong to FIFO queues which have .fifo appended.

Const defaultCredentials

defaultCredentials: Credentials = AWS_ACCESS_KEY_ID? new AWS.Credentials(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY): new AWS.SharedIniFileCredentials()

By default, load credentials from environment variables or the Shared Credentials File. as recommended.

Functions

isFifoQueueName

  • isFifoQueueName(queueName: string): boolean
  • Parameters

    • queueName: string

    Returns boolean

validateQueueName

  • validateQueueName(queueName: string): void
  • Ensures that a queue name is between 1-80 characters long and doesn't contain any illegal characters. See QueueConfig.queueName.

    Parameters

    • queueName: string

    Returns void

Object literals

Const DEFAULTS

DEFAULTS: object

Our default long-polling interval (the max allowed).

BATCH_SIZE

BATCH_SIZE: number = 1

DELETE_IMMEDIATELY

DELETE_IMMEDIATELY: boolean = false

FIFO

FIFO: boolean = false

LONG_POLLING_INTERVAL_SECONDS

LONG_POLLING_INTERVAL_SECONDS: number = 20

REGION

REGION: Region = Region.US_WEST_2

VISIBILITY_TIMEOUT_SECONDS

VISIBILITY_TIMEOUT_SECONDS: number = 600

FINISH_HANDLER

  • FINISH_HANDLER(): any

QUEUE_HANDLER

  • QUEUE_HANDLER(items: any): any

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc