How to use the ibmmq.MQPMO function in ibmmq

To help you get started, we’ve selected a few ibmmq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ibm-messaging / mq-mqi-nodejs / samples / amqsprop.js View on Github external
function putMessage(hConn,hObj) {

  var msg = "Hello from Node at " + new Date();

  var mqmd = new mq.MQMD(); // Defaults are fine.
  var pmo = new mq.MQPMO();
  var cmho = new mq.MQCMHO();

  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";
github ibm-messaging / mq-mqi-nodejs / samples / amqsput.js View on Github external
function putMessage(hObj) {

  var msg = "Hello from Node at " + new Date();

  var mqmd = new mq.MQMD(); // Defaults are fine.
  var pmo = new mq.MQPMO();

  // Describe how the Put should behave
  pmo.Options = MQC.MQPMO_NO_SYNCPOINT |
                MQC.MQPMO_NEW_MSG_ID |
                MQC.MQPMO_NEW_CORREL_ID;

  mq.Put(hObj,mqmd,pmo,msg,function(err) {
    if (err) {
      console.log(formatErr(err));
    } else {
      console.log("MsgId: " + toHexString(mqmd.MsgId));
      console.log("MQPUT successful");
    }
  });
}
github ibm-messaging / mq-mqi-nodejs / samples / amqspub.js View on Github external
function publishMessage(hObj) {

  var msg = "Hello from Node at " + new Date();

  var mqmd = new mq.MQMD(); // Defaults are fine.
  var pmo = new mq.MQPMO();

  // Describe how the Publish (Put) should behave
  pmo.Options = MQC.MQPMO_NO_SYNCPOINT |
                MQC.MQPMO_NEW_MSG_ID |
                MQC.MQPMO_NEW_CORREL_ID;
  // Add in the flag that gives a warning if noone is
  // subscribed to this topic.
  pmo.Options |= MQC.MQPMO_WARN_IF_NO_SUBS_MATCHED;
  mq.Put(hObj,mqmd,pmo,msg,function(err) {
    if (err) {
      console.error(formatErr(err));
    } else {
      console.log("MQPUT successful");
    }
  });
}
github ibm-messaging / mq-dev-patterns / Node.js / basicrequest.js View on Github external
function putMessage(hObj, hObjDynamic, cb) {

  // var msg = "Hello from Node at " + new Date();
  var msgObject = {
    'Greeting': "Hello from Node at " + new Date(),
    'value': Math.floor(Math.random() * 100)
  }
  var msg = JSON.stringify(msgObject);

  var mqmd = new mq.MQMD(); // Defaults are fine.
  mqmd.ReplyToQ = hObjDynamic._name;
  mqmd.MsgType = MQC.MQMT_REQUEST;

  var pmo = new mq.MQPMO();

  // Describe how the Put should behave
  pmo.Options = MQC.MQPMO_NO_SYNCPOINT |
    MQC.MQPMO_NEW_MSG_ID |
    MQC.MQPMO_NEW_CORREL_ID;

  mq.Put(hObj, mqmd, pmo, msg, function(err) {
    if (err) {
      debug_warn('Error Detected in Put operation', err);
      cb(err, null);
    } else {
      var msgId = toHexString(mqmd.MsgId);
      debug_info('MsgId: ', msgId);
      debug_info("MQPUT successful");
      cb(null, msgId);
    }
github ibm-messaging / mq-dev-patterns / Node.js / basicput.js View on Github external
function putMessage(hObj) {

  // var msg = "Hello from Node at " + new Date();
  var msgObject = {
    'Greeting': "Hello from Node at " + new Date()
  }
  var msg = JSON.stringify(msgObject);

  var mqmd = new mq.MQMD(); // Defaults are fine.
  var pmo = new mq.MQPMO();

  // Describe how the Put should behave
  pmo.Options = MQC.MQPMO_NO_SYNCPOINT |
    MQC.MQPMO_NEW_MSG_ID |
    MQC.MQPMO_NEW_CORREL_ID;

  mq.Put(hObj, mqmd, pmo, msg, function(err) {
    if (err) {
      debug_warn('Error Detected in Put operation', err);
    } else {
      debug_info('MsgId: ', toHexString(mqmd.MsgId));
      debug_info("MQPUT successful");
    }
  });
}
github ibm-messaging / mq-dev-patterns / Node.js / basicpublish.js View on Github external
function publishMessage(hObj) {

  var msgObject = {
    'Greeting': "Hello from Node at " + new Date()
  }
  var msg = JSON.stringify(msgObject);

  var mqmd = new mq.MQMD(); // Defaults are fine.
  var pmo = new mq.MQPMO();

  // Describe how the Publish (Put) should behave
  pmo.Options = MQC.MQPMO_NO_SYNCPOINT |
    MQC.MQPMO_NEW_MSG_ID |
    MQC.MQPMO_NEW_CORREL_ID;
  // Add in the flag that gives a warning if noone is
  // subscribed to this topic.
  pmo.Options |= MQC.MQPMO_WARN_IF_NO_SUBS_MATCHED;
  mq.Put(hObj, mqmd, pmo, msg, function(err) {
    if (err && 'object' === typeof err && err.mqrc &&
      MQC.MQRC_NO_SUBS_MATCHED == err.mqrc && err.mqrcstr) {
      debug_info('Publish unsuccessful because there are no subscribers', err.mqrcstr);
    } else if (err) {
      debug_warn('Error Detected in Put operation', err);
    } else {
      debug_info('MsgId: ', toHexString(mqmd.MsgId));
github ibm-messaging / mq-dev-patterns / Node.js / boilerplate.js View on Github external
return new Promise(function resolver(resolve, reject) {
      var pmo = new mq.MQPMO();
      var queue = me.mqObj;

      // Describe how the Put should behave
      pmo.Options = MQC.MQPMO_NO_SYNCPOINT;

      if ('REPLY' === mode) {
        queue = me.mqDynReplyObj;
      } else {
        pmo.Options |= MQC.MQPMO_NEW_MSG_ID |
          MQC.MQPMO_NEW_CORREL_ID;
      }

      if ('PUBLISH' === me.modeType) {
        pmo.Options |= MQC.MQPMO_WARN_IF_NO_SUBS_MATCHED;
      }