Skip to content

marcobarcelos/node-msmq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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