From e466c2c03f271152da28ee6301722dce390676c2 Mon Sep 17 00:00:00 2001 From: Will Date: Thu, 7 Dec 2023 21:15:53 +0000 Subject: [PATCH] comment --- pubsub/subscriber.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pubsub/subscriber.go b/pubsub/subscriber.go index f7688b8..297f11b 100644 --- a/pubsub/subscriber.go +++ b/pubsub/subscriber.go @@ -129,14 +129,16 @@ func (s *Subscriber) UnsubscribeToTopics(topicNames []string) error { return fmt.Errorf("received status %s - %s", resp, buf) } -// Consumer allows the consumption of messages. It is thread safe to range over the Msgs channel to consume. If during the consumer -// receiving messages from the server an error occurs, it will be stored in Err +// Consumer allows the consumption of messages. If during the consumer receiving messages from the +// server an error occurs, it will be stored in Err type Consumer struct { msgs chan messagebroker.Message // TODO: better error handling? Maybe a channel of errors? Err error } +// Messages returns a channel in which this consumer will put messages onto. It is safe to range over the channel since it will be closed once +// the consumer has finished either due to an error or from being cancelled. func (c *Consumer) Messages() <-chan messagebroker.Message { return c.msgs } -- 2.51.2