How to use the ibmmq.MQCD 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 / amqsconn.js View on Github external
// Create default MQCNO structure
var cno = new mq.MQCNO();

// Add authentication via the MQCSP structure
var csp = new mq.MQCSP();
csp.UserId = "mqguest";
csp.Password = "passw0rd";
// Make the MQCNO refer to the MQCSP
// This line allows use of the userid/password
cno.SecurityParms = csp;

// And use the MQCD to programatically connect as a client
// First force the client mode
cno.Options |= MQC.MQCNO_CLIENT_BINDING;
// And then fill in relevant fields for the MQCD
var cd = new mq.MQCD();
cd.ConnectionName = "localhost(1414)";
cd.ChannelName = "SYSTEM.DEF.SVRCONN";
// Make the MQCNO refer to the MQCD
cno.ClientConn = cd;

// MQ V9.1.2 allows setting of the application name explicitly
if (MQC.MQCNO_CURRENT_VERSION >= 7) {
  cno.ApplName = "Node.js 9.1.2 ApplName";
}

// Now we can try to connect
mq.Connx(qMgr, cno, function(err,conn) {
  if (err) {
    console.log(formatErr(err));
  } else {
    console.log("MQCONN to %s successful ", qMgr);
github ibm-messaging / mq-dev-patterns / Node.js / basicput.js View on Github external
// cno.Options = MQC.MQCNO_NONE;
cno.Options = MQC.MQCNO_CLIENT_BINDING;

// For no authentication, disable this block
if (credentials.USER) {
  var csp = new mq.MQCSP();
  csp.UserId = credentials.USER;
  csp.Password = credentials.PASSWORD;
  cno.SecurityParms = csp;
}

if (! ccdtCheck()) {
  debug_info('CCDT URL export is not set, will be using json envrionment client connections settings');

  // And then fill in relevant fields for the MQCD
  var cd = new mq.MQCD();

  cd.ChannelName = MQDetails.CHANNEL;
  cd.ConnectionName = getConnection();
  debug_info('Connections string is ', cd.ConnectionName);

  if (MQDetails.KEY_REPOSITORY) {
    debug_info('Will be running in TLS Mode');

    cd.SSLCipherSpec = MQDetails.CIPHER;
    cd.SSLClientAuth = MQC.MQSCA_OPTIONAL;
  }

  // Make the MQCNO refer to the MQCD
  cno.ClientConn = cd;
}
github ibm-messaging / mq-dev-patterns / Node.js / basicresponse.js View on Github external
// cno.Options = MQC.MQCNO_NONE;
cno.Options = MQC.MQCNO_CLIENT_BINDING;

// For no authentication, disable this block
if (credentials.USER) {
  var csp = new mq.MQCSP();
  csp.UserId = credentials.USER;
  csp.Password = credentials.PASSWORD;
  cno.SecurityParms = csp;
}

if (! ccdtCheck()) {
  debug_info('CCDT URL export is not set, will be using json envrionment client connections settings');

  // And then fill in relevant fields for the MQCD
  var cd = new mq.MQCD();

  cd.ChannelName = MQDetails.CHANNEL;
  cd.ConnectionName = getConnection();
  debug_info('Connections string is ', cd.ConnectionName);

  if (MQDetails.KEY_REPOSITORY) {
    debug_info('Will be running in TLS Mode');

    cd.SSLCipherSpec = MQDetails.CIPHER;
    cd.SSLClientAuth = MQC.MQSCA_OPTIONAL;
  }

  // Make the MQCNO refer to the MQCD
  cno.ClientConn = cd;
}
github ibm-messaging / mq-dev-patterns / Node.js / boilerplate.js View on Github external
// use MQCNO_CLIENT_BINDING to connect as client
    // cno.Options = MQC.MQCNO_NONE;
    mqcno.Options = MQC.MQCNO_CLIENT_BINDING;

    // For no authentication, disable this block
    if (this.credentials.USER) {
      var csp = new mq.MQCSP();
      csp.UserId = this.credentials.USER;
      csp.Password = this.credentials.PASSWORD;
      mqcno.SecurityParms = csp;
    }

    if (! MQBoilerPlate.ccdtCheck()) {
      debug_info('CCDT URL export is not set, will be using json envrionment client connections settings');
      // And then fill in relevant fields for the MQCD
      var cd = new mq.MQCD();
      cd.ChannelName = this.MQDetails.CHANNEL;

      if ('GET' === this.modeType) {
        cd.ConnectionName = this.getConnectionAt();
      } else {
        cd.ConnectionName = this.getConnection();
      }

      debug_info('Connections string is ', cd.ConnectionName);

      if (this.MQDetails.KEY_REPOSITORY) {
        debug_info('Will be running in TLS Mode');

        // *** For TLS ***
        // The TLS parameters are the minimal set needed here. You might
        // want more control such as SSLPEER values.
github ibm-messaging / mq-dev-patterns / Node.js / basicget.js View on Github external
function initialise(cno, MQDetails, credentials) {
  // For no authentication, disable this block
  if (credentials.USER) {
    let csp = new mq.MQCSP();
    csp.UserId = credentials.USER;
    csp.Password = credentials.PASSWORD;
    cno.SecurityParms = csp;
  }

  if (! ccdtCheck()) {
    debug_info('CCDT URL export is not set, will be using json envrionment client connections settings for %s', MQDetails['QMGR']);

    // And then fill in relevant fields for the MQCD
    let cd = new mq.MQCD();

    cd.ConnectionName = `${MQDetails.HOST}(${MQDetails.PORT})`;
    cd.ChannelName = MQDetails.CHANNEL;
    debug_info('Connection is ', cd.ConnectionName);

    if (MQDetails.KEY_REPOSITORY) {
      debug_info('Will be running in TLS Mode');

      cd.SSLCipherSpec = MQDetails.CIPHER;
      cd.SSLClientAuth = MQC.MQSCA_OPTIONAL;
    }

    // Make the MQCNO refer to the MQCD
    cno.ClientConn = cd;
  }
github ibm-messaging / mq-dev-patterns / Node.js / basicpublish.js View on Github external
// use MQCNO_CLIENT_BINDING to connect as client
cno.Options = MQC.MQCNO_CLIENT_BINDING;

// To add authentication, enable this block
if (credentials.USER) {
  var csp = new mq.MQCSP();
  csp.UserId = credentials.USER;
  csp.Password = credentials.PASSWORD;
  cno.SecurityParms = csp;
}

if (! ccdtCheck()) {
  debug_info('CCDT URL export is not set, will be using json envrionment client connections settings');

  // And then fill in relevant fields for the MQCD
  var cd = new mq.MQCD();

  cd.ChannelName = MQDetails.CHANNEL;
  cd.ConnectionName = getConnection();
  debug_info('Connections string is ', cd.ConnectionName);

  if (MQDetails.KEY_REPOSITORY) {
    debug_info('Will be running in TLS Mode');

    cd.SSLCipherSpec = MQDetails.CIPHER;
    cd.SSLClientAuth = MQC.MQSCA_OPTIONAL;
  }

  // Make the MQCNO refer to the MQCD
  cno.ClientConn = cd;
}
github ibm-messaging / mq-mqi-nodejs / samples / amqsconntls.js View on Github external
var cno = new mq.MQCNO();
var sco = new mq.MQSCO();

// Add authentication via the MQCSP structure
var csp = new mq.MQCSP();
csp.UserId = "mqguest";
csp.Password = "passw0rd";
// Make the MQCNO refer to the MQCSP so it knows to use the structure
cno.SecurityParms = csp;

// And use the MQCD to programatically connect as a client
// First force the client mode
cno.Options |= MQC.MQCNO_CLIENT_BINDING;

// And then fill in relevant fields for the MQCD
var cd = new mq.MQCD();
cd.ConnectionName = connName;
cd.ChannelName = "SYSTEM.SSL.SVRCONN";

// The TLS parameters are the minimal set needed here. You might
// want more control such as SSLPEER values.
// This SSLClientAuth setting means that this program does not need to
// present a certificate to the server - but it must match how the
// SVRCONN is defined on the queue manager.
// If you have to present a client certificate too then the
// SSLClientAuth is set to MQC.MQSCA_REQUIRED. You may
// also want to set the sco.CertificateLabel to choose  
// which certificate is to be sent.
cd.SSLCipherSpec = "TLS_RSA_WITH_AES_128_CBC_SHA256";
cd.SSLClientAuth = MQC.MQSCA_OPTIONAL;

// Make the MQCNO refer to the MQCD
github ibm-messaging / mq-dev-patterns / Node.js / basicsubscribe.js View on Github external
// cno.Options = MQC.MQCNO_NONE;
cno.Options = MQC.MQCNO_CLIENT_BINDING;

// For no authentication, disable this block
if (credentials.USER) {
  var csp = new mq.MQCSP();
  csp.UserId = credentials.USER;
  csp.Password = credentials.PASSWORD;
  cno.SecurityParms = csp;
}

if (! ccdtCheck()) {
  debug_info('CCDT URL export is not set, will be using json envrionment client connections settings');

  // And then fill in relevant fields for the MQCD
  var cd = new mq.MQCD();

  cd.ChannelName = MQDetails.CHANNEL;
  cd.ConnectionName = getConnection();
  debug_info('Connections string is ', cd.ConnectionName);

  if (MQDetails.KEY_REPOSITORY) {
    debug_info('Will be running in TLS Mode');

    cd.SSLCipherSpec = MQDetails.CIPHER;
    cd.SSLClientAuth = MQC.MQSCA_OPTIONAL;
  }

  // Make the MQCNO refer to the MQCD
  cno.ClientConn = cd;
}
github ibm-messaging / mq-dev-patterns / Node.js / basicrequest.js View on Github external
cno.Options = MQC.MQCNO_CLIENT_BINDING;

// For no authentication, disable this block
if (credentials.USER) {
  var csp = new mq.MQCSP();
  csp.UserId = credentials.USER;
  csp.Password = credentials.PASSWORD;
  cno.SecurityParms = csp;
}


if (! ccdtCheck()) {
  debug_info('CCDT URL export is not set, will be using json envrionment client connections settings');

  // And then fill in relevant fields for the MQCD
  var cd = new mq.MQCD();

  cd.ChannelName = MQDetails.CHANNEL;
  cd.ConnectionName = getConnection();
  debug_info('Connections string is ', cd.ConnectionName);

  if (MQDetails.KEY_REPOSITORY) {
    debug_info('Will be running in TLS Mode');

    cd.SSLCipherSpec = MQDetails.CIPHER;
    cd.SSLClientAuth = MQC.MQSCA_OPTIONAL;
  }

  // Make the MQCNO refer to the MQCD
  cno.ClientConn = cd;
}