Created
July 4, 2019 22:22
-
-
Save HenriqueSilverio/1829c00b91184c85a62e8c2334add065 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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