Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
container.on('message', function (context) {
if (context.message.properties && context.message.properties.id && context.message.properties.id < received) {
// ignore duplicate message
return;
}
if (expected === 0 || received < expected) {
console.log(context.message.body);
if (++received === expected) {
context.receiver.detach();
context.connection.close();
}
}
});
container.connect({ port: args.port, host: args.host }).open_receiver({source:{address:args.node, filter:filters.selector(args.selector)}});