Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 {
var format = mqmd.Format;
switch (format) {
case MQC.MQFMT_RF_HEADER_2:
hdr = mq.MQRFH2.getHeader(buf);
var props = mq.MQRFH2.getProperties(hdr,buf);
console.log("RFH2 HDR is %j",hdr);
console.log("Properties are '%s'",props);
printBody(hdr.Format,buf.slice(hdr.StrucLength),len-hdr.StrucLength);
break;
case MQC.MQFMT_DEAD_LETTER_HEADER:
hdr = mq.MQDLH.getHeader(buf);
console.log("DLH HDR is %j",hdr);
printBody(hdr.Format,buf.slice(hdr.StrucLength),len-hdr.StrucLength);
break;
default:
printBody(format,buf,len);
break;
}
}
});
}
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 {
var format = mqmd.Format;
switch (format) {
case MQC.MQFMT_RF_HEADER_2:
hdr = mq.MQRFH2.getHeader(buf);
var props = mq.MQRFH2.getProperties(hdr,buf);
console.log("RFH2 HDR is %j",hdr);
console.log("Properties are '%s'",props);
printBody(hdr.Format,buf.slice(hdr.StrucLength),len-hdr.StrucLength);
break;
case MQC.MQFMT_DEAD_LETTER_HEADER:
hdr = mq.MQDLH.getHeader(buf);
console.log("DLH HDR is %j",hdr);
printBody(hdr.Format,buf.slice(hdr.StrucLength),len-hdr.StrucLength);
break;
default:
printBody(format,buf,len);
break;
}
}
});