UNPKG

inceptum

Version:

hipages take on the foundational library for enterprise-grade apps written in NodeJS

37 lines 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SqsClient = void 0; const AWS = require("aws-sdk"); const LogManager_1 = require("../log/LogManager"); const log = LogManager_1.LogManager.getLogger(__filename); const awsApiVersion = '2012-11-05'; const defaultAwsRegion = 'ap-southeast-2'; class SqsClient { constructor(config, name) { this.name = name; // tslint:disable-next-line this.configuration = Object.assign({}, { apiVersion: awsApiVersion, region: defaultAwsRegion, }, config); } initialise() { this.connection = new AWS.SQS(this.configuration); } async sendMessage(params, cb) { params['QueueUrl'] = this.configuration.queueUrl; return new Promise((resolve, reject) => { this.connection.sendMessage(params, (err, data) => { if (err) { reject(err); } else { resolve(data); } }); }); } } exports.SqsClient = SqsClient; SqsClient.startMethod = 'initialise'; //# sourceMappingURL=SqsClient.js.map