+4
-2
pubsub/subscriber.go
+4
-2
pubsub/subscriber.go
···
129
129
return fmt.Errorf("received status %s - %s", resp, buf)
130
130
}
131
131
132
-
// Consumer allows the consumption of messages. It is thread safe to range over the Msgs channel to consume. If during the consumer
133
-
// receiving messages from the server an error occurs, it will be stored in Err
132
+
// Consumer allows the consumption of messages. If during the consumer receiving messages from the
133
+
// server an error occurs, it will be stored in Err
134
134
type Consumer struct {
135
135
msgs chan messagebroker.Message
136
136
// TODO: better error handling? Maybe a channel of errors?
137
137
Err error
138
138
}
139
139
140
+
// 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
141
+
// the consumer has finished either due to an error or from being cancelled.
140
142
func (c *Consumer) Messages() <-chan messagebroker.Message {
141
143
return c.msgs
142
144
}