How to use the sqs-consumer.Consumer.create function in sqs-consumer

To help you get started, we’ve selected a few sqs-consumer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github votinginfoproject / Metis / aws / sqs.js View on Github external
var createConsumer = function(queueUrl, handler) {
  var consumer = Consumer.create({
    queueUrl: queueUrl,
    handleMessage: handler,
    sqs: sqs
  });

  consumer.on('error', (err) => {
    logger.error("Error consuming SQS message from queue:", queueUrl);
    logger.error(err);
  });

  consumer.on('processing_error', (err) => {
    logger.error("Error processing SQS message from queue:", queueUrl);
    logger.error(err);
  });

  consumer.on('timeout_error', (err) => {
github mozilla / fxa / packages / fxa-event-broker / lib / notificationProcessor.ts View on Github external
constructor(
    private readonly logger: Logger,
    private readonly db: Datastore,
    private metrics: StatsD,
    private readonly capabilityService: ClientCapabilityService,
    private readonly webhookService: ClientWebhookService,
    private readonly pubsub: PubSub,
    private readonly topicPrefix: string,
    queueUrl: string,
    sqs: SQS
  ) {
    this.app = Consumer.create({
      batchSize: 10,
      handleMessage: async (message: SQS.Message) => {
        return await this.handleMessage(message);
      },
      queueUrl,
      sqs
    });

    this.app.on('error', err => {
      logger.error('consumerError', { err });
    });

    this.app.on('processing_error', err => {
      logger.error('processingError', { err });
    });

sqs-consumer

Build SQS-based Node applications without the boilerplate

Apache-2.0
Latest version published 26 days ago

Package Health Score

92 / 100
Full package analysis