Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

LOKE/loke-queue

Repository files navigation

loke-queue

NPM Version Build Status

Simple RabbitMQ wrapper exposing queue functionality.

Example

var Connection = require('loke-queue').Connection

var connection = new Connection('amqp://localhost')

var queue = connection.queue('jobs', {maxConcurrent: 20, retryAfterMilliseconds: 10 * 60 * 1000})

queue.subscribe('demo.*', function (message) {
  console.log(message)
  return new Promise(function (resolve) {
    setTimeout(resolve, 500)
  })
})

setTimeout(function (){
  queue.stop()
})

connection.publish('demo.test', {
  message: 'Hello World'
})