Open typecampo opened 2 years ago
@jnmoyne could you confirm?
Technically Close is correct but I feel the steps should elaborate a little bit. Conn.Drain() performs a Drain on all subs which results in an unsubscribe as described by sub.Drain(). The unsubscribe causes the library to delete the durable consumer. So I think some mention of unsubscribe should be included in the steps of Conn.Drain() to make the reader aware that an unsubscribe will occur, not just a close of connection.
https://github.com/nats-io/nats.go/blob/41cb5bc08cf2791d7bc904af913680e96a42e70b/nats.go#L4816
The problem is not so much the documentation as the current behavior of the library being in question. We will have to see what the conclusion of https://github.com/nats-io/nats.go/issues/874 is first and then adjust the documentation accordingly.
https://docs.nats.io/using-nats/developer/receiving/drain
number 4 should be changed from Close to Unsubscribe given the implications of Unsubscribe on a durable consumer.
If it were Close then Drain would not delete the durable consumer.
see nats-io/nats.go#874