NewConsumerFromClient creates a new consumer using the given client. It is still necessary to call Close() on the underlying client when shutting down this consumer.
(client Client)
| 120 | // NewConsumerFromClient creates a new consumer using the given client. It is still |
| 121 | // necessary to call Close() on the underlying client when shutting down this consumer. |
| 122 | func NewConsumerFromClient(client Client) (Consumer, error) { |
| 123 | // For clients passed in by the client, ensure we don't |
| 124 | // call Close() on it. |
| 125 | cli := &nopCloserClient{client} |
| 126 | return newConsumer(cli) |
| 127 | } |
| 128 | |
| 129 | func newConsumer(client Client) (Consumer, error) { |
| 130 | // Check that we are not dealing with a closed Client before processing any other arguments |