@benie/lambda-lib
Version:
Builders and tools for creating AWS Lambda function handlers that provides automation for things such as logging, instrumentation and parameters propagation
14 lines (11 loc) • 378 B
JavaScript
const snsClient = require('./client/sns-client');
class EventBus {
constructor(snsTopicArnPrefix) {
this._snsTopicArnPrefix = snsTopicArnPrefix;
}
async emit(eventName, eventContents) {
let topicName = `${this._snsTopicArnPrefix}__event__${eventName}`;
return snsClient.publish(topicName, eventContents);
}
}
module.exports = EventBus;