🐂 Added moleculer-bull

1. Added Bull MQ for enqueuing uncompression job
2. Added socket.io init code
3. Added a queue microservice
This commit is contained in:
2021-10-27 14:24:55 -07:00
parent 0ea5f78e98
commit a15bfafa01
3 changed files with 15 additions and 18 deletions

View File

@@ -98,21 +98,16 @@ export default class ApiService extends Service {
this.io.on("connection", (client) => {
this.logger.info("Client connected via websocket!");
client.on("action", (action, done) => {
client.on("action", async (action) => {
switch (action.type) {
case "LS_IMPORT":
this.broker
.call(
"libraryqueue.enqueue",
action.data,
{}
)
.then((res) => {
if (done) {
done(res);
}
})
.catch((err) => this.logger.error(err));
// 1. Send task to queue
const result = await this.broker.call(
"libraryqueue.enqueue",
action.data,
{}
);
break;
}
});