How to use the @cumulus/ingest/consumer.Consumer function in @cumulus/ingest

To help you get started, we’ve selected a few @cumulus/ingest 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 nasa / cumulus / packages / api / lambdas / sqs-message-consumer.js View on Github external
await Promise.all(rules.map(async (rule) => {
    const queueUrl = rule.rule.value;

    if (!(await sqsQueueExists(queueUrl))) return Promise.resolve();

    const consumer = new Consumer({
      queueUrl: queueUrl,
      messageLimit,
      timeLimit,
      visibilityTimeout: rule.meta.visibilityTimeout,
      deleteProcessedMessage: false
    });
    log.info(`processQueues for rule ${rule.name} and queue ${queueUrl}`);
    return consumer.consume(dispatchFn.bind({ rule: rule }));
  }));
}
github nasa / cumulus / packages / api / lambdas / sf-starter.js View on Github external
async function handleEvent(event, dispatchFn, visibilityTimeout) {
  const messageLimit = event.messageLimit || 1;
  const timeLimit = get(event, 'timeLimit', 240);

  if (!event.queueUrl) {
    throw new Error('queueUrl is missing');
  }

  if (timeLimit <= 0) {
    throw new Error('timeLimit must be greater than 0');
  }

  const consumer = new Consumer({
    queueUrl: event.queueUrl,
    messageLimit,
    timeLimit,
    visibilityTimeout
  });
  return consumer.consume(dispatchFn);
}