@nestjstools/messaging-amazon-sqs-extension
Version:
Extension to handle messages and dispatch them over Amazon SQS
28 lines • 905 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AmazonSqsChannel = void 0;
const messaging_1 = require("@nestjstools/messaging");
const client_sqs_1 = require("@aws-sdk/client-sqs");
class AmazonSqsChannel extends messaging_1.Channel {
client;
constructor(config) {
super(config);
this.client = new client_sqs_1.SQSClient({
endpoint: config.endpoint,
region: config.region,
credentials: config.credentials,
});
if (!config.autoCreate) {
return;
}
this.client.send(new client_sqs_1.CreateQueueCommand({
QueueName: config.queueName,
}));
}
async onChannelDestroy() {
this.client.destroy();
return super.onChannelDestroy();
}
}
exports.AmazonSqsChannel = AmazonSqsChannel;
//# sourceMappingURL=amazon-sqs.channel.js.map