How to use the ibmmq.MQGMO 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 / amqsgeta.js View on Github external
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
github ibm-messaging / mq-mqi-nodejs / samples / amqsdlh.js View on Github external
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);
github ibm-messaging / mq-dev-patterns / Node.js / basicsubscribe.js View on Github external
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;
github ibm-messaging / mq-mqi-nodejs / samples / amqsget.js View on Github external
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 {
github ibm-messaging / mq-dev-patterns / Node.js / boilerplate.js View on Github external
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);
github ibm-messaging / mq-dev-patterns / Node.js / basicresponse.js View on Github external
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;