node-msmq

    0.1.3 • Public • Published

    node-msmq

    A MSMQ implementation for node.js

    Install

    $ npm install --save node-msmq
    

    Usage

    Send a message

    Sends a message to a MSMQ queue.

    const msmq = require('node-msmq');
     
    var queue = msmq.openOrCreateQueue('.\\Private$\\MyAwesomeQueue');
     
    // Send message to queue
    queue.send('Hello from Node.JS!');

    Receive messages

    Start receiving messages from a queue.

    const msmq = require('node-msmq');
     
    var queue = msmq.openOrCreateQueue('.\\Private$\\MyAwesomeQueue');
     
    // Set receive listener callback
    queue.on('receive', (msg) => {
      console.log(msg.body);
    });
     
    // Start receiving messages from the queue
    queue.startReceiving();

    Get all messages

    Gets all messages without removing them from queue.

    const msmq = require('node-msmq');
     
    var queue = msmq.openOrCreateQueue('.\\Private$\\MyAwesomeQueue');
    var messages = queue.getAllMessages();

    Purge a queue

    Clears all messages from the queue.

    const msmq = require('node-msmq');
     
    var queue = msmq.openOrCreateQueue('.\\Private$\\MyAwesomeQueue');
    queue.purge();

    License

    MIT © Marco Barcelos

    Install

    npm i node-msmq

    DownloadsWeekly Downloads

    8

    Version

    0.1.3

    License

    MIT

    Last publish

    Collaborators

    • marcobarcelos