rabbitmq / rabbitmq-stream-go-client

A client library for RabbitMQ streams
MIT License
170 stars 20 forks source link

Notify functions should check if the client is closed #248

Open Zerpet opened 1 year ago

Zerpet commented 1 year ago

https://github.com/rabbitmq/rabbitmq-stream-go-client/blob/b7086877761337310b475db1a1809edbad2cdb30/pkg/raw/client.go#L1289-L1296

These functions could check that the client is not closed, nor closing. We could change the signature to return a channel and an error, and return a specific error when the client is not open.

Zerpet commented 1 year ago

I'm undecided if it's needed, other than for correctness. I came up with this when I was thinking about the idempotency of raw.Client.Close() and Client.shutdown(). Given that all notify and shutdown function synchronise, this may not be needed at all.