dino-express
Version:
DinO enabled REST framework based on express
31 lines • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventProducer = void 0;
class EventProducer {
eventQueue;
defaultInfo;
environment;
constructor(eventQueue, environment, title, version) {
this.eventQueue = eventQueue;
this.environment = environment;
this.defaultInfo = {
application: {
name: this.environment.getOrDefault('app:name', 'unknown'),
title,
version
},
environment: this.environment,
serverType: this.environment.getOrDefault('dino:server:type', 'unknown'),
cloud: this.environment.getOrDefault('dino:cloud', {})
};
}
send(applicationEvent) {
this.enrich(applicationEvent);
return this.eventQueue.add(applicationEvent);
}
enrich(applicationEvent) {
applicationEvent.addToPayload(this.defaultInfo);
}
}
exports.EventProducer = EventProducer;
//# sourceMappingURL=EventProducer.js.map