UNPKG

inceptum

Version:

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

35 lines 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); 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; 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); } }); }); } } SqsClient.startMethod = 'initialise'; exports.SqsClient = SqsClient; //# sourceMappingURL=SqsClient.js.map