Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (myArgs[1]) {
qMgr = myArgs[1];
}
if (myArgs[2]) {
msgId = myArgs[2];
}
if (myArgs[3]) {
msgId2 = myArgs[3];
}
mq.setTuningParameters({ syncMQICompat: true });
// Connect to the queue manager, including a callback function for
// when it completes.
mq.Conn(qMgr, function (err, hConn) {
if (err) {
console.log(formatErr(err));
ok = false;
} else {
console.log("MQCONN to %s successful ", qMgr);
connectionHandle = hConn;
// 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_INPUT_AS_Q_DEF;
mq.Open(hConn, od, openOptions, function (err, hObj) {
queueHandle = hObj;
if (err) {
console.log(formatErr(err));
// Connect to the queue manager. If that works, the callback function
// opens the topic, and then we can start to retrieve messages.
console.log("Sample AMQSSUB.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];
}
// Do the connect, including a callback function
mq.Conn(qMgr, function(err,hConn) {
if (err) {
console.log("MQCONN ended with reason code " + err.mqrc);
} else {
console.log("MQCONN to %s successful ", qMgr);
// Define what we want to open, and how we want to open it.
var sd = new mq.MQSD();
sd.ObjectString = topicString;
sd.Options = MQC.MQSO_CREATE
| MQC.MQSO_NON_DURABLE
| MQC.MQSO_FAIL_IF_QUIESCING
| MQC.MQSO_MANAGED;
mq.Sub(hConn,null,sd,function(err,hObjPubQ,hObjSubscription) {
if (err) {
console.log("MQSUB ended with reason " + err.mqrc);
if (myArgs[0]) {
qName = myArgs[0];
}
if (myArgs[1]) {
qMgr = myArgs[1];
}
if (myArgs[2]) {
msgId = myArgs[2];
}
mq.setTuningParameters({syncMQICompat:true});
// Connect to the queue manager, including a callback function for
// when it completes.
mq.Conn(qMgr, function(err,hConn) {
if (err) {
console.log(formatErr(err));
ok = false;
} else {
console.log("MQCONN to %s successful ", qMgr);
connectionHandle = hConn;
// 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_INPUT_AS_Q_DEF;
mq.Open(hConn,od,openOptions,function(err,hObj) {
queueHandle = hObj;
if (err) {
console.log(formatErr(err));
* opens the queue, and then we can start to retrieve messages.
*/
console.log("Sample AMQSBRA.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];
}
// Connect to the queue manager, including a callback function for
// when it completes.
mq.Conn(qMgr, function(err,hConn) {
if (err) {
console.log(formatErr(err));
} else {
console.log("MQCONN to %s successful ", qMgr);
connectionHandle = hConn;
// 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_BROWSE; // Indicate non-destructive retrieval needed
mq.Open(hConn,od,openOptions,function(err,hObj) {
queueHandle = hObj;
if (err) {
console.log(formatErr(err));
} else {
// opens the queue, and then we can start to retrieve messages.
console.log("Sample AMQSGET.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];
}
// Do the connect, including a callback function
mq.Conn(qMgr, 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_INPUT_AS_Q_DEF;
mq.Open(hConn,od,openOptions,function(err,hObj) {
if (err) {
console.log(formatErr(err));
} else {
console.log("MQOPEN of %s successful",qName);
// And loop getting messages until done.