'use strict';
module.exports = class PublishEndpoint {
constructor(conn) {
this.conn = conn;
}
publish(namespace, data) {
return new Promise((resolve, reject) => {
this.conn
.createChannel()
.then(ch => {
ch.publish(namespace, namespace, data, {contentType: 'application/vnd.masstransit+json'});
ch.close();
resolve();
}, reject);
});
}
};