Allow Kafka healthchecks to write to a custom topic name
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
## Background and Motivation
Currently the healthchecks for Aspire.Confluent.Kafka writes to a hard-coded default topic name of "healthchecks-topic". In an enterprise setting there's often strict rules around topic names that the default name doesn't match. Therefore it would be a good idea to expose the topic name in the settings object.
## Proposed API
```diff
public sealed class KafkaProducerSettings
{
+ ///
+ /// Gets or sets the string value that indicates the Kafka topic that the health check will produce to.
+ ///
+ ///
+ /// The default value is "healthchecks-topic",
+ ///
+ public string HealthChecksTopic { get; set; } = "healthchecks-topic";
```
```diff
public sealed class KafkaConsumerSettings
{
+ ///
+ /// Gets or sets the string value that indicates the Kafka topic that the health check will produce to.
+ ///
+ ///
+ /// The default value is "healthchecks-topic",
+ ///
+ public string HealthChecksTopic { get; set; } = "healthchecks-topic";
```
## Usage Examples
appsettings.json
```json
{
"Aspire": {
"Confluent": {
"Kafka": {
"Producer": {
"HealthChecksTopic": "custom-healthchecks-topic"
},
"Consumer": {
"HealthChecksTopic": "custom-healthchecks-topic"
}
```
## Alternative Designs
None. The proposed API seems like the obvious place where one would look for this setting.
## Risks
The default setting would be the same as now, so it should not be breaking.
Contributor guide
Assessment
This issue has not been assessed yet.