#How to ensure that events are received by RabbitMq?

11 messages · Page 1 of 1 (latest)

winged iron
#

Hi,

I use Quorum queues to enrure, that the queue and its message are durable and persistent, but emitting events on the publisher side still causes problems:

Let's assume I emit 1000 events each with a size of 1mb. This will result in an empty queue. Not a single event is received by RabbitMq, because it run into a heartbeat timeout.

To get rid of this problem, I tried to use the setTimeout() function and "activly" wait 10ms between each events. This approach works in my test setup, but in a real world scenario I couldn't trust, that 10ms are enough.

In the rabbitmq documentation I read about publisher confirms and how they work together with durable and persistents queue. This should fix my problem.

But I don't how to use this feature with a ClientProxy. I think I have to get the ampqlib instance and overwrite the emit / send methods.

Any ideas how to get the amqplib instance of a ClientProxy?

An example how to confirm queue works, can be found here: https://github.com/amqp-node/amqplib/blob/main/examples/waitForConfirms.js

GitHub

AMQP 0-9-1 library and client for Node.JS. Contribute to amqp-node/amqplib development by creating an account on GitHub.

hidden willow
#

when "noAck:true" automatic remove if event are received

winged iron
hidden willow
#

use rxjs observable pattern

winged iron
winged iron
#

I took a deep look in the implementation of nestjs/microservices

#

and at the docs for amqplib and amqp-connection-manager

#

the amqp-connectionmanager uses confirmCannels by default

#

and overwrite sendToQueue / publish functions of amqplib

#

the override adds aawaitConfirm methods automatically