I'm trying to add a queue mechanism for my micro-service processor that I built, in short, the processor get an id from other server (by REST call), add information from DB and creates a new object with enriched id data. The queue manager should manage an array of id's and enrich data after
x milliseconds OR y amount of id's. (the enrichment will be done as a bulk)
How can I do this? How to manage the queue?
I know that there is setInterval()
function which is great but it only solves me the time issue, how can I add another condition to also do the enrichment by array length?