1.1.0 • Published 1 year ago

@skycatch-api/skyport-messaging v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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
})