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
797 stars 129 forks source link

how about TCP level reconnection? #12

Closed pwli0755 closed 3 years ago

pwli0755 commented 3 years ago

Thank you for this nice project!

I'm new to rabbitmq, here is my question: It seems this lib has handled the reconnection logic of amqp.Channel level, shall we handle the underlaying TCP connection (amqp.Connection) as well?

func (c *Connection) NotifyClose(receiver chan *Error) chan *Error {
    c.m.Lock()
    defer c.m.Unlock()

    if c.noNotify {
        close(receiver)
    } else {
        c.closes = append(c.closes, receiver)
    }

    return receiver
}
pwli0755 commented 3 years ago

forget it! my mistake.

if the Connection is closed, the Channel will be closed too, so maybe there is no need to handle TCP level re-connection any more.