All Projects → parse-community → parse-server-sqs-mq-adapter

parse-community / parse-server-sqs-mq-adapter

Licence: other
Spread work queue accross cluster of parse servers using SQS

Programming Languages

javascript
184084 projects - #8 most used programming language

parse-server-sqs-mq-adapter

Build Status codecov Greenkeeper badge

AWS SQS backed message queue. This adapter allows a work queue to be spread across a cluster of machines.

Installation

npm install --save @parse/sqs-mq-adapter

Usage

const ParseServer = require('parse-server').ParseServer;
const SQSEventEmitterMQ = require('@parse/sqs-mq-adapter').SQSEventEmitterMQ;

config = {
  ....
  queueOptions: {
    messageQueueAdapter: SQSEventEmitterMQ,
    queueUrl: 'https://sqs.us-east-1.amazonaws.com/XXX/Parse-Queue', // required
    region: 'us-east-1',
  },
};

const parseServer = new ParseServer(config);

See: sqs-consumer for complete list of configuration options.

Credentials

By default the consumer will look for AWS credentials in the places specified by the AWS SDK. The simplest option is to export your credentials as environment variables:

export AWS_SECRET_ACCESS_KEY=...
export AWS_ACCESS_KEY_ID=...

If you need to specify your credentials manually, you can use a pre-configured instance of the AWS SQS client:

const ParseServer = require('parse-server').ParseServer;
const SQSEventEmitterMQ = require('@parse/sqs-mq-adapter').SQSEventEmitterMQ;
const AWS = require('aws-sdk');

AWS.config.update({
  region: 'eu-west-1',
  accessKeyId: '...',
  secretAccessKey: '...'
});

config = {
  ....
  messageQueueAdapter: SQSEventEmitterMQ,
  SQSEventEmitterMQOptions: {
    queueUrl: 'https://sqs.us-east-1.amazonaws.com/XXX/Parse-Queue',
    sqs: new AWS.SQS(),
  },
};

const parseServer = new ParseServer(config);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].