1.3.2 • Published 6 years ago

zeromq-mdp-nodejs v1.3.2

Weekly downloads
15
License
ISC
Repository
github
Last release
6 years ago

NodeJS MajorDomo Protocol API

A NodeJS implementation of Worker and Client API's of the Majordomo pattern protocol.

Pattern: http://zguide.zeromq.org/page:all#header-99

Specification: https://rfc.zeromq.org/spec:7/MDP/

Installation

Worker API

const brokerURL = 'tcp://127.0.0.1:5555'
const serviceName = 'hello-world-service'

let worker = new mdp.Worker(brokerURL, serviceName)

worker.on('request', (req, res) => {
    // process request and respond
    res.send(req.body + ' world!')
})

worker.start()

Client API

const brokerURL = 'tcp://127.0.0.1:5555'

let client = mdp.Client(brokerURL)

client.on('response', (res) => {
    // process the response
    console.log('Client received message: ', res.body)
})

client.start()
client.send('hello-world-service', 'hello')

Worker Options

OptionDefaultDescription
heartrate2500The heartbeat timeout in milliseconds.
reconnect2500The time in milliseconds before attempting to reconnect to broker.
heartbeatLiveness3The number of heartbeats before disconnecting from broker.
verbose1Verbosity levels for logging (0-none, 1-events, 2-messages).
nameserviceThe identity prefix of the worker, defaults to the service name.
toStringtrueConvert received messages from Buffer to String.
1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago