wagslane / go-rabbitmq

A wrapper of streadway/amqp that provides reconnection logic and sane defaults
https://blog.boot.dev/golang/connecting-to-rabbitmq-in-golang-easy/
MIT License
805 stars 128 forks source link

consumer: v0.14.0 implementation can lead to unprocessable messages #173

Closed gnuletik closed 4 months ago

gnuletik commented 5 months ago

While reviewing the code of v0.14.0, I realized that the consumer returns NackRequeue automatically if a mutex is locked.

https://github.com/wagslane/go-rabbitmq/blob/ef6a38050e8e093ad2e0aad5e1f7e37e593548c2/consume.go#L96-L98

However, I'm concerned that when using a policy with a delivery-limit, this will lead to messages landing in a DLQ "silently" (without any error on the consumer side).

WDYT of removing this automatic NackRequeue and wait for the mutex instead?

Thanks!

wagslane commented 4 months ago

The disadvantage is that the shutdowns become slower, potentially hanging for awhile I think. I think we wait until someone actually runs into this issue in production with an example we can learn from?

gnuletik commented 4 months ago

I think we wait until someone actually runs into this issue in production with an example we can learn from?

This will be really hard to debug IMO.