MutiMQ
Wrapper for using different message queue systems, such as: zeromq, axon and hypermq.
Allows use of multiple message queueing systems within this single module, providing a universal set of common commands. Message queues supported:
Installation
From your terminal, requires node.js.
npm install multimq
The zmq
module is a binding so it is not installed by default, if you wish to use zmq (zeromq) you will need to install it separately within the multimq
folder:
npm install zmq
Options
service
set a service/socket namemq
axon, zmq, hypermqpattern
push / pull, pub / sub, req / rep (axon, zmq), chit / chat (hypermq), pub-emitter / sub-emitter (axon), router / dealer (zmq)socket
bind, connect, bindSync (zmq)hostname
hostname addressport
host portsecure
hypermq booleankey
hypermq ssl/tls key filenamecert
hypermq ssl/tls certificate filenameapikey
hypermq apikey stringprotocol
hypermq amp, ldjson
Events
closed
when peer closes.error
(err) when an un-handled socket error occurs.reconnect attempt
when a reconnection attempt is made.connected
(any url queries sent as object) when connected to the peer, or a peer connection is accepted.queued
(msg) when a message is enqueued, can use to save unsent messages.flushed
(total messages) queued when messages are flushed on connection.message
(msg) the message received by peer.
Example
bind
:
var multimq = ;var service = multimq; var options = service: 'myService' mq: 'hypermq' pattern: 'pub' socket: 'bind' hostname: '127.0.0.1' port: 3443 secure: false key: __dirname + '/key.pem' cert: __dirname + '/cert.pem' apikey: 'za91j2bk72f483ap62x' protocol: 'amp'; var myService = options;console; ;
connect
:
var multimq = ;var service = multimq; var options = service: 'myService' mq: 'hypermq' pattern: 'sub' socket: 'connect' hostname: '127.0.0.1' port: 3443 secure: false apikey: 'za91j2bk72f483ap62x' protocol: 'amp' rejectUnauthorized: false; var myService = options;console; myService;
License
Choose either: MIT or Apache 2.0.