Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getMessages() {
var md = new mq.MQMD();
var gmo = new mq.MQGMO();
gmo.Options = MQC.MQGMO_NO_SYNCPOINT |
MQC.MQGMO_WAIT |
MQC.MQGMO_CONVERT |
MQC.MQGMO_FAIL_IF_QUIESCING;
gmo.MatchOptions = MQC.MQMO_NONE;
gmo.WaitInterval = waitInterval * 1000; // 3 seconds
if (msgId != null) {
console.log("Setting Match Option for MsgId");
gmo.MatchOptions = MQC.MQMO_MATCH_MSG_ID;
md.MsgId = hexToBytes(msgId);
}
// Set up the callback handler to be invoked when there
// are any incoming messages. As this is a sample, I'm going
function getMessage(hObj) {
var buf = Buffer.alloc(1024);
var mqmd = new mq.MQMD();
var gmo = new mq.MQGMO();
gmo.Options = MQC.MQGMO_NO_SYNCPOINT |
MQC.MQGMO_NO_WAIT |
MQC.MQGMO_CONVERT |
MQC.MQGMO_FAIL_IF_QUIESCING;
try {
var len = mq.GetSync(hObj,mqmd,gmo,buf);
var format = mqmd.Format;
// If the message has a DLH then
// parse and print it.
if (format == MQC.MQFMT_DEAD_LETTER_HEADER) {
var hdr = mq.MQDLH.getHeader(buf);
console.log("HDR is %j",hdr);
printMessage(hdr.Format,buf.slice(hdr.StrucLength),len-hdr.StrucLength);
function getMessage(hObj) {
var buf = Buffer.alloc(1024);
var mqmd = new mq.MQMD();
var gmo = new mq.MQGMO();
//gmo.WaitInterval = 3 * 1000; // 3 seconds
gmo.WaitInterval = 30 * 1000; // 30 seconds
gmo.Options = MQC.MQGMO_NO_SYNCPOINT |
MQC.MQGMO_WAIT |
MQC.MQGMO_CONVERT |
MQC.MQGMO_FAIL_IF_QUIESCING;
mq.GetSync(hObj, mqmd, gmo, buf, function(err, len) {
if (err) {
if (err.mqrc == MQC.MQRC_NO_MSG_AVAILABLE) {
debug_info("no more messages");
} else {
debug_warn("MQGET failed with " + err.mqrc);
}
ok = false;
function getMessage(hObj) {
var buf = Buffer.alloc(1024);
var hdr;
var mqmd = new mq.MQMD();
var gmo = new mq.MQGMO();
gmo.Options = MQC.MQGMO_NO_SYNCPOINT |
MQC.MQGMO_NO_WAIT |
MQC.MQGMO_CONVERT |
MQC.MQGMO_FAIL_IF_QUIESCING;
mq.GetSync(hObj,mqmd,gmo,buf,function(err,len) {
if (err) {
if (err.mqrc == MQC.MQRC_NO_MSG_AVAILABLE) {
console.log("no more messages");
} else {
console.log(formatErr(err));
}
ok = false;
} else {
return new Promise(function resolver(resolve, reject) {
var md = new mq.MQMD();
var gmo = new mq.MQGMO();
gmo.Options = MQC.MQGMO_NO_SYNCPOINT |
MQC.MQGMO_WAIT |
MQC.MQGMO_CONVERT |
MQC.MQGMO_FAIL_IF_QUIESCING;
if ('GET' === me.modeType) {
gmo.MatchOptions = MQC.MQMO_NONE;
}
gmo.WaitInterval = waitInterval * 1000; //
if (msgId != null) {
console.log("Setting Match Option for MsgId");
gmo.MatchOptions = MQC.MQMO_MATCH_MSG_ID;
md.MsgId = MQBoilerPlate.hexToBytes(msgId);
function getMessage(hConn, hObj) {
var buf = Buffer.alloc(1024, 0);
var mqmd = new mq.MQMD();
var gmo = new mq.MQGMO();
gmo.Options = MQC.MQGMO_NO_SYNCPOINT |
MQC.MQGMO_NO_WAIT |
MQC.MQGMO_CONVERT |
MQC.MQGMO_FAIL_IF_QUIESCING;
mq.GetSync(hObj, mqmd, gmo, buf, function(err, len) {
if (err) {
if (err.mqrc == MQC.MQRC_NO_MSG_AVAILABLE) {
debug_info("no more messages");
} else {
debug_warn('Error retrieving message', err);
}
ok = false;
} else if (mqmd.Format == "MQSTR") {
var msgObject = null;