Skip to content

Instantly share code, notes, and snippets.

@HenriqueSilverio
Created July 4, 2019 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HenriqueSilverio/1829c00b91184c85a62e8c2334add065 to your computer and use it in GitHub Desktop.
Save HenriqueSilverio/1829c00b91184c85a62e8c2334add065 to your computer and use it in GitHub Desktop.
const BrokerManager = function BrokerManager () {
let connection = null
let channel = null
return Object.create({
async getConnection () {
if (!connection) {}
return connection
},
async getChannel () {
if (!channel) {}
return channel
}
})
}
module.exports = BrokerManager
const QueueManager = function QueueManager ($tag = 'default', $broker = null) {
let tag = $tag
let broker = $broker
let channel = null
return Object.create({
async start () {
channel = await broker.getChannel()
await channel.assertQueue(tag, { durable: true })
}
})
}
module.exports = QueueManager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment