Closed yaziine closed 5 years ago
@asdine 🆙
I wish the tests were less internal so that we could keep exactly the same tests and thereby have better confidence that behaviour hasn't changed
@rogpeppe IIUC you mean that we should have more integration test? But it involves having a kafka instance spawned etc...
@asdine No changes required regarding kafka-go.
@rogpeppe before merging it I want to be sure that your comments are well addressed.
@asdine
@rogpeppe IIUC you mean that we should have more integration test? But it involves having a kafka instance spawned etc...
This is an area that needs some serious consideration, I think. Maybe there's room for a decent quality Kafka fake implementation (as opposed to a mock) that can be run in-process.
From my point of view, a lot of the value of tests isn't just that they give you confidence that your code works now, but also give confidence across future code refactoring such as what we're doing in this PR. So when I see tests being removed or significantly changing as a result of what should be a behaviour-preserving refactor, it makes me concerned that perhaps the tests could be better.
This isn't your fault, of course, but is something that's perhaps worth pondering in the future.
I merge the PR. I created an issue feel free to continue the discussion there.
@rogpeppe I'll create an issue regarding that 👍
Since sarama-cluster has been deprecated, this PR uses the Sarama's Consumer Group API.
Before, the way Kafka was consuming messages was configured through the cluster.ConsumerMode option saying that we want a go routine for each topics/partitions.
Now, it is already handled by Sarama. There is a ConsumerGroupHandler for the group which runs a separate goroutine (ConsumeClaim function) for each topics/partitions.
This fixes #39.