Я использую пакет модуля узла sqs-consumer.
У меня есть следующий код:
init: function () {
var app = Consumer.create({
queueUrl: Settings.getSetting("sendgrid-aws-sqs-queue"),
batchSize: 1,
visibilityTimeout: 30,
waitTimeSeconds: 20,
sqs: MarvelAWS.sqs,
handleMessage: function (message, done) {
try {
var msgBody;
try {
msgBody = JSON.parse(message.Body);
} catch (err) {
msgBody = null;
this._warn("parsing error handling SQS queue " + err, msgBody);
}
var environment = Settings.getSetting('environment');
if (validateMsg(msgBody) && (environment !== "prod" || this.LIST_TO_ID[msgBody.listId.toString()])) {
var userProfile = msgBody.profile,
timeSent = msgBody.timeSent,
action = msgBody.action,
listId = msgBody.listId.toString(),
suppressionListId = msgBody.suppressionListId.toString();
_.each(this.actionsMap[action], function (oneAction) {
this._debug(oneAction + ':' + listId + ' ' + msgBody.profile.email);
sendgridQueueManager.createQueue({
action: oneAction
});
sendgridQueueManager.push({
action: oneAction,
listId: listId,
suppressionListId: suppressionListId,
timeSent: timeSent,
profile: userProfile
});
}.bind(this));
EngineMonitor.countOperation(EngineMonitor.OPS.SENDGRID_SQS_QUEUE_PULL_SUCCESS);
} else {
this._warn("validation error", msgBody);
EngineMonitor.countOperation(EngineMonitor.OPS.SENDGRID_SQS_QUEUE_PULL_ERROR);
}
done();
} catch (err) {
this._warn("error_processing_message " + err);
done(new Error('error processing message'));
}
}.bind(this)
});
app.on("message_received", function () {
this._debug("message_received");
EngineMonitor.countOperation(EngineMonitor.OPS.SENDGRID_SQS_QUEUE_MESSAGE_RECEIVED);
}.bind(this));
app.on("message_processed", function () {
this._debug("message_processed");
EngineMonitor.countOperation(EngineMonitor.OPS.SENDGRID_SQS_QUEUE_MESSAGE_PROCESSED);
}.bind(this));
app.on("error", function (err, message) {
this._warn("message_error " + err + " " + message);
EngineMonitor.countOperation(EngineMonitor.OPS.SENDGRID_SQS_QUEUE_PULL_ERROR);
}.bind(this));
app.on("processing_error", function (err, message) {
this._warn("processing_error " + err);
EngineMonitor.countOperation(EngineMonitor.OPS.SENDGRID_SQS_QUEUE_PULL_ERROR);
}.bind(this));
app.start();
this._debug('sqs_app_start');
},
иногда сообщение добавляется в очередь SQS, но неполучить получателя / Вот мои настройки очереди sqs:
Может ли кто-нибудь помочь?
В каких случаях сообщение добавляется в очередьи не получен потребителем?