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
772 stars 126 forks source link

NotifyPublish seems hardly usable #66

Closed Malufasu closed 2 years ago

Malufasu commented 2 years ago

Since amqp091.NotifyPublish tag is an incremental id that is bound to the amqp091.Channel, we cannot identify which message we receive a publish notification for after an automatic reconnect (since the tag is silently reset to 0). This is an issue linked to how amqp091 secretly handles this id.

If possible, it would be better for this lib to associate the amqp091.Channel tag to a unique rabbitmq.Publisher tag (that is incremented each time we publish without error). That would remove the impact of re-connection, so the original behavior is kept.

Possible solution:

This should ensure the original behaviour is kept even with reconnection.

wagslane commented 2 years ago

Resolved in v0.8.1 with new "ReconnectionCount" field.