Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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) => {
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 });
});