@skycatch-api/skyport-messaging
v1.2.0
Published
Nodejs lib to encapsuate messaging to many queue brokers (as of now, just RabbitMQ)
Downloads
2
Readme
skyport-messaging
Nodejs lib to encapsuate messaging to many queue brokers (as of now, just RabbitMQ)
Produce message
const MessagingClient = require('skyport-messaging')('RabbitMQ');
const client = new MessagingClient();
await client.connect({
url: process.env.BROKER_URL,
connectionName: 'my_connection'
})
await client.produce('myQueueName', { myMessage: 'Hello' })
Consume messages
const MessagingClient = require('skyport-messaging')('RabbitMQ');
const client = new MessagingClient();
await client.connect({
url: process.env.BROKER_URL,
connectionName: 'my_connection'
})
await client.consume('myQueueName', (message) => {
///do something with the message
})