Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mq.CrtMh(hConn, cmho,function(err,mh) {
if (err) {
console.log(formatErr(err));
} else {
var smpo = new mq.MQSMPO();
var pd = new mq.MQPD();
// Note how the "value" of each property can change datatype
// without needing to be explicitly stated.
var name="PROP1STRING";
var value="helloStringProperty";
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP2INT";
value=42;
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP3BOOL";
mq.SetMp(hConn,mh,smpo,name,pd,true);
name="PROP4BYTEARRAY";
value=Buffer.alloc(6);
for (var i=0;i<6;i++) {
value[i] = 0x64 + i;
}
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP5NULL";
mq.SetMp(hConn,mh,smpo,name,pd);
}
// Describe how the Put should behave and put the message
var value="helloStringProperty";
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP2INT";
value=42;
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP3BOOL";
mq.SetMp(hConn,mh,smpo,name,pd,true);
name="PROP4BYTEARRAY";
value=Buffer.alloc(6);
for (var i=0;i<6;i++) {
value[i] = 0x64 + i;
}
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP5NULL";
mq.SetMp(hConn,mh,smpo,name,pd);
}
// Describe how the Put should behave and put the message
pmo.Options = MQC.MQPMO_NO_SYNCPOINT |
MQC.MQPMO_NEW_MSG_ID |
MQC.MQPMO_NEW_CORREL_ID;
// Make sure the message handle is used during the Put
pmo.OriginalMsgHandle = mh;
mq.Put(hObj,mqmd,pmo,msg,function(err) {
if (err) {
console.log(formatErr(err));
mq.CrtMh(hConn, cmho,function(err,mh) {
if (err) {
console.log(formatErr(err));
} else {
var smpo = new mq.MQSMPO();
var pd = new mq.MQPD();
// Note how the "value" of each property can change datatype
// without needing to be explicitly stated.
var name="PROP1STRING";
var value="helloStringProperty";
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP2INT";
value=42;
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP3BOOL";
mq.SetMp(hConn,mh,smpo,name,pd,true);
name="PROP4BYTEARRAY";
value=Buffer.alloc(6);
for (var i=0;i<6;i++) {
value[i] = 0x64 + i;
}
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP5NULL";
name="PROP2INT";
value=42;
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP3BOOL";
mq.SetMp(hConn,mh,smpo,name,pd,true);
name="PROP4BYTEARRAY";
value=Buffer.alloc(6);
for (var i=0;i<6;i++) {
value[i] = 0x64 + i;
}
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP5NULL";
mq.SetMp(hConn,mh,smpo,name,pd);
}
// Describe how the Put should behave and put the message
pmo.Options = MQC.MQPMO_NO_SYNCPOINT |
MQC.MQPMO_NEW_MSG_ID |
MQC.MQPMO_NEW_CORREL_ID;
// Make sure the message handle is used during the Put
pmo.OriginalMsgHandle = mh;
mq.Put(hObj,mqmd,pmo,msg,function(err) {
if (err) {
console.log(formatErr(err));
} else {
console.log("MQPUT successful");
}
} else {
var smpo = new mq.MQSMPO();
var pd = new mq.MQPD();
// Note how the "value" of each property can change datatype
// without needing to be explicitly stated.
var name="PROP1STRING";
var value="helloStringProperty";
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP2INT";
value=42;
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP3BOOL";
mq.SetMp(hConn,mh,smpo,name,pd,true);
name="PROP4BYTEARRAY";
value=Buffer.alloc(6);
for (var i=0;i<6;i++) {
value[i] = 0x64 + i;
}
mq.SetMp(hConn,mh,smpo,name,pd,value);
name="PROP5NULL";
mq.SetMp(hConn,mh,smpo,name,pd);
}
// Describe how the Put should behave and put the message
pmo.Options = MQC.MQPMO_NO_SYNCPOINT |
MQC.MQPMO_NEW_MSG_ID |
MQC.MQPMO_NEW_CORREL_ID;