Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P-Queue OpenWA #73

Open
edneijunior opened this issue May 8, 2021 · 0 comments
Open

P-Queue OpenWA #73

edneijunior opened this issue May 8, 2021 · 0 comments

Comments

@edneijunior
Copy link

Hello friends, can someone help me to deploy a message delivery queue following OpenwA standards?

global.openWA = require('@open-wa/wa-automate');
const fs = require('fs');
const async = require("async");
const request = require('request');
const moment = require('moment');
const mime = require('mime-types');
const { default: PQueue } = require("p-queue");

const queue = new PQueue({
concurrency: 1,
timeout: 2000
});

WHATS_API.prototype.SETUP = function (CLIENT, WEBHOOK_INPUT, TOKEN_INPUT) {
var that = this;
that.WEBHOOK = WEBHOOK_INPUT;
that.TOKEN = TOKEN_INPUT;
that.CONNECTION = CLIENT;
CLIENT.onMessage(message => {
queue.add(()=>that.PROCESS_MESSAGE(message));
queue.start();
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant