Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ibmmq-facade

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ibmmq-facade

A high level interface to the ibmmq library

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

IBMMQ FACADE

A high abstraction facade to the ibmmq library.

Installation

npm install --save ibmmq-facade

Examples

Connecting to our queue manager and queue
const {queueManagerConnector, queueConnector, Queue} = require('ibmmq-facade');

const config = {
  host: 'localhost',
  port: 1750,
  user: 'user',
  password: 'password',
  queueManagerName: 'qMgr',
  channelName: 'chName'
};

(async function() {
  try {
    // returns the queue manager handle object which must be passed in when connecting a queue
    const qmHandle = await queueManagerConnector.connect(config);

    const queueName = 'MY_QUEUE';
    // returns a queue handle which must be passed to your queue data structure
    // when retrieving or sending messages
    const queueHandle = await queueConnector.connect(qmHandle, queueName);
  } catch (error) {
    return false;
  } finally {
    queueConnector.clean();
    queueManagerConnector.clean();
  }
})

Getting messages from queue
// this buffer can be any integer lower than the queue managers max message length (in bytes)
// if you know the size of data on a queue, it is best to set this manually
// if you are unsure, then set it to queue managers the max message length
const buffer = queueManagerConnector.getConnectionOptions().ClientConn.MaxMsgLength;
const queue = new Queue(queueHandle, buffer);

while (queue.isMessages()) {
  const message = queue.dequeue();

  // do something with the message contents?
  console.log(message);
}
Putting messages on to a local queue
const queueHandle = queueConnector.connect(queueManagerConnector.getHandle(), 'QUEUE_NAME');
const queue = new Queue(queueHandle);

const message = "Hello World";
queue.enqueue(message);
Putting messages on to a remote queue
const queueHandle = queueConnector.connect(queueManagerConnector.getHandle(), 'QUEUE_NAME', true); // true to allow posting to remote queue
const queue = new Queue(queueHandle);

const message = "Hello World";
queue.enqueue(message);

Public methods

QueueManagerConnector
  • QueueManager::isConfigValid(configObject) : bool
  • QueueManager::connect(configObject) : object
  • QueueManager::getHandle() : object
  • QueueManager::clean()
QueueConnector
  • QueueConnector::getQueueOptions() : object
  • QueueConnector::connect(queueManagerHandle, queueName [, isRemoteQueue]) : object
  • QueueConnector::getHandle() : object
  • QueueConnector::clean()
Queue
  • Queue::__construct(queueHandle [, buffer])
  • Queue::dequeue() : buffer
  • Queue::enqueue(message)
  • Queue::isMessages() : bool
  • Queue::peek() : object

FAQs

Package last updated on 24 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc