amqprs icon indicating copy to clipboard operation
amqprs copied to clipboard

No heartbeats sent with long-running consume functions?

Open dtebbs opened this issue 1 year ago • 4 comments

I have a client which accepts "requests", executes a long running computation (several minutes) and then writes the result to a response queue before ack-ing the original request. I have set the tokio runtime to multi-threaded, 2 worker threads, and the prefetch for the request queue is 1.

Since the consume function is async, I assumed that heartbeats would automatically be sent while I am processing requests. I also tried spawning in the handler to do the processing. However if the processing lasts long enough then the rabbitmq server closes my connection due to lack of heartbeat.

I'm not very familiar with the protocol or the amqprs implementation, so I'm wondering if this is expected and I must set the heartbeat timeout much higher, or should heartbeats be sent by other tasks while processing is going on and I'm doing something wrong?

Thanks in advance for any advice.

dtebbs avatar Jul 03 '24 21:07 dtebbs