-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to move consumer.Stop
from Kafka-go as a well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
"github.com/pkg/errors" | ||
) | ||
|
||
// Consumer is a Kafka consumer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌷 this isn't a great comment, but I'll pick this up in the documentation work.
} | ||
} | ||
|
||
func (c *Consumer) convertMessage(cm *sarama.ConsumerMessage) *message.Message { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌷 this is the sort of thing that we might want to pull out of the Consumer
type and make public if we want people to be able to user felice in a modular way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, if they want to do some specific task/changes in the message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The consumer lacks logs, especially debug logs describing the lifecycle of the goroutines, consumption attempts etc. Even though some of these will be written in Kafka-Go, I'm not sure it will be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add logging we should do it via an interface. It's probably OK to expect a structured logger (after all you could write an adapter to use a non-structured one if you really wish). Perhaps this is something for a separate branch?
I'm not sure we should go as far as abstracting logging: This is an opinionated library and IMO this kind of library can choose how it logs (whether by using the std logger or a third party library) and simply allow the user choose the output and the level if any; Sarama and a lot of other libraries already do that. |
Maybe we can do as Sarama does. By default, it logs to ioutil.Discard but if the user wants to retrieve the logs, he has to set the |
Something like that would be cool yeah, a library shouldn't print anything by default. |
It's for why I want to remove the loggers because it's not common (based on my experience) to have library logs as a project will do (think of regula for example). |
Not printing by default and not providing logs are two different things. It's important for a library to log when it's doing internal complex stuff, regardless of the output, and it is the user's choice to display these logs or not. |
For me (until these days) a library didn't have to log. If something goes wrong, it just returns errors and the users will manage that with logs and so on. But now it's more clear for me. |
I like the |
|
||
func (c *Consumer) setup() { | ||
if c.handlers == nil { | ||
c.handlers = &handler.Collection{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌷 What is the reasoning behind having c.handlers
as a pointer since all we do is instantiate it like this? Shouldn't we simply use a value field instead of a pointer field?
Fix #10.
Notes: