Example of Assign() is slightly misleading
See original GitHub issueDescription
While consumer group is not used in Assign() scenarios, it still needs to be provided for whatever reason. In the samples new Guid()
is used for naming that group. It seems to be misleading, because in most scenarios Guids are used as unique identifiers, but in this case it is just a constant (00000000-0000-0000-0000-000000000000
).
As a result developers often get incorrect assumption that consumer group names for Assign() should be unique (even with each service restart). They just blindly miss that Guid is created via new Guid()
but not Guid.NewGuid()
. And it ends up with hundreds of empty consumer groups with Guid names in clusters.
I seems to be better to specify some hardcoded constant (and probably explicitly state that that value could be used for ALL services if needed).
How to reproduce
- Change this line to
GroupId = Guid.NewGuid().ToString(),
- Run sample few times
- New consumer group with unique name is created each time. Old groups are not removed.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Perhaps
Guid.Empty
might be a better way to convey the fact that the value should remain stable?Though I’d favor
"TestConsumerGroupName"
or something more explicitClosing the issue as the example has been fixed now.