Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
let durable = false;
if(subscription && clientname) {
durable = true;
}
const container = require('rhea');
const connectOptions: ContainerOptions = {
host: credentials.hostname,
port: credentials.port,
reconnect: true, // this id the default anyway
reconnect_limit: 50, // try for max 50 times, based on a back-off algorithm
container_id: (durable ? clientname : null)
};
if (credentials.username || credentials.password) {
container.options.username = credentials.username;
container.options.password = credentials.password;
}
let lastMsgId: number | undefined = undefined;
const self = this;
container.on('message', (context: any) => { // tslint:disable-line:no-any
if (context.message.message_id && context.message.message_id === lastMsgId) {
// ignore duplicate message check, don't think it's necessary, but it was in the rhea-lib example code
lastMsgId = context.message.message_id;
return;
}
self.emit([self.helpers.returnJsonArray([context.message])]);
});
const connection = container.connect(connectOptions);
let durable = false;
if(subscription && clientname) {
durable = true;
}
const container = require('rhea');
const connectOptions: ContainerOptions = {
host: credentials.hostname,
port: credentials.port,
reconnect: true, // this id the default anyway
reconnect_limit: 50, // try for max 50 times, based on a back-off algorithm
container_id: (durable ? clientname : null)
};
if (credentials.username || credentials.password) {
container.options.username = credentials.username;
container.options.password = credentials.password;
}
let lastMsgId: number | undefined = undefined;
const self = this;
container.on('message', (context: any) => { // tslint:disable-line:no-any
if (context.message.message_id && context.message.message_id === lastMsgId) {
// ignore duplicate message check, don't think it's necessary, but it was in the rhea-lib example code
lastMsgId = context.message.message_id;
return;
}
self.emit([self.helpers.returnJsonArray([context.message])]);
});
const connection = container.connect(connectOptions);
let clientOptions = undefined;
}
if (sink === '') {
throw new Error('Queue or Topic required!');
}
const container = require('rhea');
const connectOptions: ContainerOptions = {
host: credentials.hostname,
port: credentials.port,
reconnect: true, // this id the default anyway
reconnect_limit: 50, // try for max 50 times, based on a back-off algorithm
};
if (credentials.username || credentials.password) {
container.options.username = credentials.username;
container.options.password = credentials.password;
}
const allSent = new Promise(( resolve ) => {
container.on('sendable', (context: any) => { // tslint:disable-line:no-any
const message = {
application_properties: headerProperties,
body: JSON.stringify(item)
};
const sendResult = context.sender.send(message);
resolve(sendResult);
});
});
if (sink === '') {
throw new Error('Queue or Topic required!');
}
const container = require('rhea');
const connectOptions: ContainerOptions = {
host: credentials.hostname,
port: credentials.port,
reconnect: true, // this id the default anyway
reconnect_limit: 50, // try for max 50 times, based on a back-off algorithm
};
if (credentials.username || credentials.password) {
container.options.username = credentials.username;
container.options.password = credentials.password;
}
const allSent = new Promise(( resolve ) => {
container.on('sendable', (context: any) => { // tslint:disable-line:no-any
const message = {
application_properties: headerProperties,
body: JSON.stringify(item)
};
const sendResult = context.sender.send(message);
resolve(sendResult);
});
});
var container = require('rhea');
var args = require('../options.js').options({
'username': { describe: 'username to connect with'},
'password': { describe: 'password to connect with (will use PLAIN)'},
'h': { alias: 'host', default: 'localhost', describe: 'dns or ip name of server where you want to connect'},
'p': { alias: 'port', default: 5671, describe: 'port to connect to'}
}).help('help').argv;
/**
* Default SASL behaviour is as follows. If the username and password
* are both specified, PLAIN will be used. If only a username is
* specified, ANONYMOUS will be used. If neither is specified, no SASl
* layer will be used.
*/
if (args.username) {
container.options.username = args.username;
}
if (args.password) {
container.options.password = args.password;
}
container.on('connection_open', function (context) {
console.log('Connected!');
context.connection.close();
});
container.connect({ port: args.port, host: args.host });
'username': { describe: 'username to connect with'},
'password': { describe: 'password to connect with (will use PLAIN)'},
'p': { alias: 'port', default: 5671, describe: 'port to connect to'}
}).help('help').argv;
/**
* Default SASL behaviour is as follows. If the username and password
* are both specified, PLAIN will be used. If only a username is
* specified, ANONYMOUS will be used. If neither is specified, no SASl
* layer will be used.
*/
if (args.username) {
container.options.username = args.username;
}
if (args.password) {
container.options.password = args.password;
}
container.on('connection_open', function (context) {
console.log('Connected!');
context.connection.close();
});
container.connect({'port':args.port});
*/
var container = require('rhea');
var args = require('../options.js').options({
'username': { describe: 'username to connect with'},
'password': { describe: 'password to connect with (will use PLAIN)'},
'p': { alias: 'port', default: 5671, describe: 'port to connect to'}
}).help('help').argv;
/**
* Default SASL behaviour is as follows. If the username and password
* are both specified, PLAIN will be used. If only a username is
* specified, ANONYMOUS will be used. If neither is specified, no SASl
* layer will be used.
*/
if (args.username) {
container.options.username = args.username;
}
if (args.password) {
container.options.password = args.password;
}
container.on('connection_open', function (context) {
console.log('Connected!');
context.connection.close();
});
container.connect({'port':args.port});
'password': { describe: 'password to connect with (will use PLAIN)'},
'h': { alias: 'host', default: 'localhost', describe: 'dns or ip name of server where you want to connect'},
'p': { alias: 'port', default: 5671, describe: 'port to connect to'}
}).help('help').argv;
/**
* Default SASL behaviour is as follows. If the username and password
* are both specified, PLAIN will be used. If only a username is
* specified, ANONYMOUS will be used. If neither is specified, no SASl
* layer will be used.
*/
if (args.username) {
container.options.username = args.username;
}
if (args.password) {
container.options.password = args.password;
}
container.on('connection_open', function (context) {
console.log('Connected!');
context.connection.close();
});
container.connect({ port: args.port, host: args.host });