-
Notifications
You must be signed in to change notification settings - Fork 2
Rename Method #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename Method #83
Changes from 2 commits
6d96a73
0cb52f9
ccf1d45
890628f
ebcfbe5
69afb1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,7 +63,7 @@ public static TBuilder WithClientIdFormatter<TBuilder>(this TBuilder builder, Fu | |
| return builder; | ||
| } | ||
|
|
||
| public static TBuilder WithPartitionHandler<TBuilder>(this TBuilder builder, Func<object, List<TopicPartition>, IEnumerable<TopicPartitionOffset>> handler) | ||
| public static TBuilder WithPartitionAssignedHandler<TBuilder>(this TBuilder builder, Func<object, List<TopicPartition>, IEnumerable<TopicPartitionOffset>> handler) | ||
| where TBuilder : IKafkaConventionBuilder | ||
| { | ||
|
|
||
|
|
@@ -82,6 +82,47 @@ public static TBuilder WithPartitionHandler<TBuilder>(this TBuilder builder, Fun | |
|
|
||
| return builder; | ||
| } | ||
|
|
||
| public static TBuilder WithPartitionRevokedHandler<TBuilder>(this TBuilder builder, Func<object, List<TopicPartitionOffset>, IEnumerable<TopicPartitionOffset>> handler) | ||
| where TBuilder : IKafkaConventionBuilder | ||
| { | ||
|
|
||
| builder.Add(b => | ||
| { | ||
| if (!b.MetaData.OfType<ConsumerHandlerMetadata>().Any()) | ||
| { | ||
| b.MetaData.Add(new ConsumerHandlerMetadata()); | ||
| } | ||
|
|
||
| foreach (var item in b.MetaData.OfType<ConsumerHandlerMetadata>()) | ||
| { | ||
| item.PartitionsRevokedHandler = handler; | ||
| } | ||
| }); | ||
|
|
||
| return builder; | ||
| } | ||
|
|
||
| public static TBuilder WithPartitionLostHandler<TBuilder>(this TBuilder builder, Func<object, List<TopicPartitionOffset>, IEnumerable<TopicPartitionOffset>> handler) | ||
| where TBuilder : IKafkaConventionBuilder | ||
| { | ||
|
|
||
| builder.Add(b => | ||
| { | ||
| if (!b.MetaData.OfType<ConsumerHandlerMetadata>().Any()) | ||
| { | ||
| b.MetaData.Add(new ConsumerHandlerMetadata()); | ||
| } | ||
|
|
||
| foreach (var item in b.MetaData.OfType<ConsumerHandlerMetadata>()) | ||
| { | ||
| item.PartitionsLostHandler = handler; | ||
| } | ||
| }); | ||
|
|
||
| return builder; | ||
| } | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same delegate-type mismatch for Partitions Lost handler Analogous to the previous comment, 🤖 Prompt for AI Agents |
||
| public static TBuilder WithErrorHandler<TBuilder>(this TBuilder builder, Action<object, Error> handler) | ||
| where TBuilder : IKafkaConventionBuilder | ||
| { | ||
|
|
@@ -122,6 +163,26 @@ public static TBuilder WithStatisticsHandler<TBuilder>(this TBuilder builder, Ac | |
| return builder; | ||
| } | ||
|
|
||
| public static TBuilder WithLogHandler<TBuilder>(this TBuilder builder, Action<object, LogMessage> handler) | ||
| where TBuilder : IKafkaConventionBuilder | ||
| { | ||
|
|
||
| builder.Add(b => | ||
| { | ||
| if (!b.MetaData.OfType<ConsumerHandlerMetadata>().Any()) | ||
| { | ||
| b.MetaData.Add(new ConsumerHandlerMetadata()); | ||
| } | ||
|
|
||
| foreach (var item in b.MetaData.OfType<ConsumerHandlerMetadata>()) | ||
| { | ||
| item.LogHandler = handler; | ||
| } | ||
| }); | ||
|
|
||
| return builder; | ||
| } | ||
|
|
||
| public static TBuilder WithAutoCommit<TBuilder>(this TBuilder builder, bool enabled = true) | ||
| where TBuilder : IKafkaConventionBuilder | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,15 +4,20 @@ namespace MinimalKafka.Metadata; | |
|
|
||
| public interface IConsumerHandlerMetadata | ||
| { | ||
| Func<object, List<TopicPartition>, IEnumerable<TopicPartitionOffset>>? PartitionsAssignedHandler { get; set; } | ||
|
|
||
| Action<object, string>? StatisticsHandler { get; set;} | ||
| Action<object, Error>? ErrorHandler { get; set; } | ||
| Func<object, List<TopicPartition>, IEnumerable<TopicPartitionOffset>>? PartitionsAssignedHandler { get; } | ||
| Func<object, List<TopicPartitionOffset>, IEnumerable<TopicPartitionOffset>>? PartitionsLostHandler { get; } | ||
| Func<object, List<TopicPartitionOffset>, IEnumerable<TopicPartitionOffset>>? PartitionsRevokedHandler { get; } | ||
| Action<object, string>? StatisticsHandler { get; } | ||
| Action<object, Error>? ErrorHandler { get; } | ||
| Action<object, LogMessage>? LogHandler { get; } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delegate type mismatch – these should be For Func<object, List<TopicPartitionOffset>, IEnumerable<TopicPartitionOffset>>?The underlying Confluent handlers are void-returning, so exposing them as -Func<object, List<TopicPartitionOffset>, IEnumerable<TopicPartitionOffset>>? PartitionsLostHandler { get; }
-Func<object, List<TopicPartitionOffset>, IEnumerable<TopicPartitionOffset>>? PartitionsRevokedHandler { get; }
+Action<object, List<TopicPartitionOffset>>? PartitionsLostHandler { get; }
+Action<object, List<TopicPartitionOffset>>? PartitionsRevokedHandler { get; }Please update both interface and extension methods accordingly. 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| internal class ConsumerHandlerMetadata : IConsumerHandlerMetadata | ||
| { | ||
| public Func<object, List<TopicPartition>, IEnumerable<TopicPartitionOffset>>? PartitionsAssignedHandler { get; set; } | ||
| public Func<object, List<TopicPartitionOffset>, IEnumerable<TopicPartitionOffset>>? PartitionsLostHandler { get; set; } | ||
| public Func<object, List<TopicPartitionOffset>, IEnumerable<TopicPartitionOffset>>? PartitionsRevokedHandler { get; set; } | ||
| public Action<object, string>? StatisticsHandler { get; set; } | ||
| public Action<object, Error>? ErrorHandler { get; set; } | ||
| public Action<object, LogMessage>? LogHandler { get; set; } | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep implementation in sync after changing interface After adjusting the interface (previous comment), remember to change the implementation properties to -public Action<object, List<TopicPartitionOffset>, IEnumerable<TopicPartitionOffset>>? PartitionsLostHandler { get; set; }
-public Action<object, List<TopicPartitionOffset>, IEnumerable<TopicPartitionOffset>>? PartitionsRevokedHandler { get; set; }
+public Action<object, List<TopicPartitionOffset>>? PartitionsLostHandler { get; set; }
+public Action<object, List<TopicPartitionOffset>>? PartitionsRevokedHandler { get; set; }Failing to do so will leave the class unable to satisfy the (corrected) interface.
🤖 Prompt for AI Agents |
||
Uh oh!
There was an error while loading. Please reload this page.