feat: consumer name #92
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Used to identify the uniqueness of consumers.
Greptile Summary
This PR adds a
Name()method to thekafkaQueuestruct in the Kafka queue implementation. The method is a simple getter that returns the consumer name from the configuration (q.c.Name). This change enables consumers to be uniquely identified by name, which is essential for monitoring, debugging, and managing multiple queue instances in distributed systems.The implementation fits into the existing codebase architecture by likely satisfying an interface contract from the go-zero framework's
queue.MessageQueueinterface. ThekafkaQueuestruct already contains a configuration field (q.c) with aNameproperty, so this change simply exposes that existing data through a standardized method. This is a common pattern in Go where structs implement interfaces by providing required methods.The change integrates seamlessly with the existing queue management system, allowing developers to programmatically access queue names for logging, metrics collection, or administrative purposes. Since queue names are already being configured in the
KqConfstructure, this method provides a clean API to access that information without breaking encapsulation.Confidence score: 5/5