This commit is contained in:
AdisakKanthawilang 2024-11-18 11:25:50 +07:00
parent 5a9da1d428
commit 0c70fe006f

View file

@ -27,7 +27,7 @@ export async function init() {
channel.assertQueue(queue, { durable: true }); //----> (1.5) assert queue and set durable (if "true" save to disk on RabbitMQ)
channel.assertQueue(queue_org, { durable: true });
// channel.prefetch(1);
channel.prefetch(1);
sendToQueue = (payload: any, persistent = true) => {
//----> (2) sendQueue To RabbitMQ and set persistent (if "true" redo the failed queue when server run again)
@ -42,8 +42,8 @@ export async function init() {
console.log("[AMQ] Listening for message...");
createConsumer(queue, channel, handler); //----> (3) Process Consumer
createConsumer(queue_org, channel, handler_org);
await createConsumer(queue, channel, handler); //----> (3) Process Consumer
await createConsumer(queue_org, channel, handler_org);
// createConsumer(queue2, channel, handler2);
}