Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// The program really starts here.
// Connect to the queue manager. If that works, the callback function
// opens the queue, and then we can put a message.
console.log("Sample AMQSPUT.JS start");
// Get command line parameters
var myArgs = process.argv.slice(2); // Remove redundant parms
if (myArgs[0]) {
qName = myArgs[0];
}
if (myArgs[1]) {
qMgr = myArgs[1];
}
var cno = new mq.MQCNO();
cno.Options = MQC.MQCNO_NONE; // use MQCNO_CLIENT_BINDING to connect as client
// To add authentication, enable this block
if (false) {
var csp = new mq.MQCSP();
csp.UserId = "metaylor";
csp.Password = "passw0rd";
cno.SecurityParms = csp;
}
mq.Connx(qMgr, cno, function(err,hConn) {
if (err) {
console.log(formatErr(err));
} else {
console.log("MQCONN to %s successful ", qMgr);
// The program really starts here.
// Connect to the queue manager. If that works, the callback function
// opens the topic, and then we can put a message.
console.log("Sample AMQSPUB.JS start");
// Get command line parameters
var myArgs = process.argv.slice(2); // Remove redundant parms
if (myArgs[0]) {
topicString = myArgs[0];
}
if (myArgs[1]) {
qMgr = myArgs[1];
}
var cno = new mq.MQCNO();
cno.Options = MQC.MQCNO_NONE; // use MQCNO_CLIENT_BINDING to connect as client
// To add authentication, enable this block
if (false) {
var csp = new mq.MQCSP();
csp.UserId = "metaylor";
csp.Password = "passw0rd";
cno.SecurityParms = csp;
}
mq.Connx(qMgr, cno, function(err,hConn) {
if (err) {
console.error(formatErr(err));
} else {
console.log("MQCONN to %s successful ", qMgr);
// The program really starts here.
// Connect to the queue manager. If that works, the callback function
// opens the queue for SET, and then we can do the real setting.
console.log("Sample AMQSSET.JS start");
// Get command line parameters
var myArgs = process.argv.slice(2); // Remove redundant parms
if (myArgs[0]) {
qName = myArgs[0];
}
if (myArgs[1]) {
qMgr = myArgs[1];
}
var cno = new mq.MQCNO();
cno.Options = MQC.MQCNO_NONE;
mq.Connx(qMgr, cno, function(err,hConn) {
if (err) {
console.log(formatErr(err));
} else {
console.log("MQCONN to %s successful ", qMgr);
// Define what we want to open, and how we want to open it.
// In this case, we want to INQUIRE on attributes of the queue manager so we
// get an object handle that refers to that qmgr.
// No ObjectName is needed for this inquiry - the fact that it is the Q_MGR type
// is sufficient.
var od = new mq.MQOD();
od.ObjectName = qName;
od.ObjectType = MQC.MQOT_Q;
}
}
// The program really starts here.
// Connect to the queue manager. If that works, the callback function
// opens the queue manager for inquiry, and then we can do the real query.
console.log("Sample AMQSINQ.JS start");
// Get command line parameters
var myArgs = process.argv.slice(2); // Remove redundant parms
if (myArgs[0]) {
qMgr = myArgs[0];
}
var cno = new mq.MQCNO();
cno.Options = MQC.MQCNO_NONE;
mq.Connx(qMgr, cno, function(err,hConn) {
if (err) {
console.log(formatErr(err));
} else {
console.log("MQCONN to %s successful ", qMgr);
// Define what we want to open, and how we want to open it.
// In this case, we want to INQUIRE on attributes of the queue manager so we
// get an object handle that refers to that qmgr.
// No ObjectName is needed for this inquiry - the fact that it is the Q_MGR type
// is sufficient.
var od = new mq.MQOD();
od.ObjectName = null;
od.ObjectType = MQC.MQOT_Q_MGR;
// The program really starts here.
// Connect to the queue manager. If that works, the callback function
// opens the queue, and then we can put a message.
console.log("Sample AMQSPROP.JS start");
// Get command line parameters
var myArgs = process.argv.slice(2); // Remove redundant parms
if (myArgs[0]) {
qName = myArgs[0];
}
if (myArgs[1]) {
qMgr = myArgs[1];
}
var cno = new mq.MQCNO();
cno.Options = MQC.MQCNO_NONE;
mq.Connx(qMgr, cno, function(err,hConn) {
if (err) {
console.log(formatErr(err));
} else {
console.log("MQCONN to %s successful ", qMgr);
// Define what we want to open, and how we want to open it.
var od = new mq.MQOD();
od.ObjectName = qName;
od.ObjectType = MQC.MQOT_Q;
var openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_INPUT_AS_Q_DEF;
mq.Open(hConn,od,openOptions,function(err,hObj) {
if (err) {
console.log(formatErr(err));
if (fs.existsSync(ccdtFile)) {
debug_info("CCDT File found at ", ccdtFile);
return true;
}
}
return false;
}
// The program really starts here.
// Connect to the queue manager. If that works, the callback function
// opens the topic, and then we can put a message.
debug_info('Running on ', process.platform);
debug_info('Starting up Application');
var cno = new mq.MQCNO();
// cno.Options = MQC.MQCNO_NONE;
// use MQCNO_CLIENT_BINDING to connect as client
cno.Options = MQC.MQCNO_CLIENT_BINDING;
// To add authentication, enable this block
if (credentials.USER) {
var csp = new mq.MQCSP();
csp.UserId = credentials.USER;
csp.Password = credentials.PASSWORD;
cno.SecurityParms = csp;
}
if (! ccdtCheck()) {
debug_info('CCDT URL export is not set, will be using json envrionment client connections settings');
// And then fill in relevant fields for the MQCD
buildMQCNO() {
debug_info('Establishing connection details');
var mqcno = new mq.MQCNO();
// use MQCNO_CLIENT_BINDING to connect as client
// cno.Options = MQC.MQCNO_NONE;
mqcno.Options = MQC.MQCNO_CLIENT_BINDING;
// For no authentication, disable this block
if (this.credentials.USER) {
var csp = new mq.MQCSP();
csp.UserId = this.credentials.USER;
csp.Password = this.credentials.PASSWORD;
mqcno.SecurityParms = csp;
}
if (! MQBoilerPlate.ccdtCheck()) {
debug_info('CCDT URL export is not set, will be using json envrionment client connections settings');
// And then fill in relevant fields for the MQCD
var cd = new mq.MQCD();
if (fs.existsSync(ccdtFile)) {
debug_info("CCDT File found at ", ccdtFile);
return true;
}
}
return false;
}
// The program really starts here.
// Connect to the queue manager. If that works, the callback function
// opens the topic, and then we can start to retrieve messages.
debug_info('Running on ', process.platform);
debug_info('Starting up Application');
var cno = new mq.MQCNO();
// use MQCNO_CLIENT_BINDING to connect as client
// cno.Options = MQC.MQCNO_NONE;
cno.Options = MQC.MQCNO_CLIENT_BINDING;
// For no authentication, disable this block
if (credentials.USER) {
var csp = new mq.MQCSP();
csp.UserId = credentials.USER;
csp.Password = credentials.PASSWORD;
cno.SecurityParms = csp;
}
if (! ccdtCheck()) {
debug_info('CCDT URL export is not set, will be using json envrionment client connections settings');
// And then fill in relevant fields for the MQCD
if (CCDT in process.env) {
let ccdtFile = process.env[CCDT].replace(FILEPREFIX, '');
debug_info(ccdtFile);
if (fs.existsSync(ccdtFile)) {
debug_info("CCDT File found at ", ccdtFile);
return true;
}
}
return false;
}
debug_info('Running on ', process.platform);
debug_info('Starting up Application');
var cno = new mq.MQCNO();
// use MQCNO_CLIENT_BINDING to connect as client
// cno.Options = MQC.MQCNO_NONE;
cno.Options = MQC.MQCNO_CLIENT_BINDING;
// For no authentication, disable this block
if (credentials.USER) {
var csp = new mq.MQCSP();
csp.UserId = credentials.USER;
csp.Password = credentials.PASSWORD;
cno.SecurityParms = csp;
}
if (! ccdtCheck()) {
debug_info('CCDT URL export is not set, will be using json envrionment client connections settings');
// And then fill in relevant fields for the MQCD
return new Promise(function resolver(resolve, reject) {
let MQDetails = {};
let credentials = {};
let endpointString = '';
let cno = new mq.MQCNO();
cno.Options = MQC.MQCNO_CLIENT_BINDING;
buildMQDetails(MQDetails, credentials, index)
.then(() => {
endpointString = `${MQDetails.HOST}(${MQDetails.PORT})`;
debug_info('Getting messages from ', endpointString);
return initialise(cno, MQDetails, credentials);
}).then(() => {
return processConnection(cno, MQDetails);
}).then(() => {
debug_info('Endpoint processing complete for ', endpointString);
resolve();
}).catch(() => {
debug_warn('Error during processing of endpoint %d ', index);
reject();
});