Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function popFormattingStart(routingKey) {
for (let i = 0; i < pendingFormats.length; i++) {
const pendingFormat = pendingFormats[i];
if (getRoutingKeyPattern(pendingFormat.content.endRoutingKey).test(routingKey)) {
logger.debug(`<${id}> completed formatting ${fields.routingKey} message content with formatter ${routingKey}`);
pendingFormats.splice(i, 1);
pendingFormat.ack();
break;
}
}
}
}
let environment = elements.Environment(options);
const emitter = new EventEmitter();
const engine = Object.assign(emitter, {
execute,
logger,
getDefinitionById,
getDefinitions,
getState,
recover,
resume,
stop,
waitFor,
});
const broker = Broker(engine);
broker.assertExchange('event', 'topic', {autoDelete: false});
Object.defineProperty(engine, 'broker', {
enumerable: true,
get() {
return broker;
}
});
Object.defineProperty(engine, 'name', {
enumerable: true,
get() {
return name;
},
set(value) {
name = value;
function EventBroker(brokerOwner, options, onBrokerReturn) {
const broker = Broker(brokerOwner);
const pfx = options.prefix;
broker.assertExchange('event', 'topic', options);
broker.on('return', onBrokerReturn || onBrokerReturnFn);
return {
eventPrefix: pfx,
broker,
on,
once,
waitFor,
emit,
emitFatal,
};
function on(eventName, callback, eventOptions = { once: false }) {