|
|
@@ -15,7 +15,7 @@ using Microsoft.Extensions.Options; |
|
|
|
|
|
|
|
namespace DotNetCore.CAP.Kafka |
|
|
|
{ |
|
|
|
internal sealed class KafkaConsumerClient : IConsumerClient |
|
|
|
public class KafkaConsumerClient : IConsumerClient |
|
|
|
{ |
|
|
|
private static readonly SemaphoreSlim ConnectionLock = new SemaphoreSlim(initialCount: 1, maxCount: 1); |
|
|
|
|
|
|
@@ -153,9 +153,7 @@ namespace DotNetCore.CAP.Kafka |
|
|
|
config.EnableAutoCommit ??= false; |
|
|
|
config.LogConnectionClose ??= false; |
|
|
|
|
|
|
|
_consumerClient = new ConsumerBuilder<string, byte[]>(config) |
|
|
|
.SetErrorHandler(ConsumerClient_OnConsumeError) |
|
|
|
.Build(); |
|
|
|
BuildConsumer(config); |
|
|
|
} |
|
|
|
} |
|
|
|
finally |
|
|
@@ -164,6 +162,13 @@ namespace DotNetCore.CAP.Kafka |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void BuildConsumer(ConsumerConfig config) |
|
|
|
{ |
|
|
|
_consumerClient = new ConsumerBuilder<string, byte[]>(config) |
|
|
|
.SetErrorHandler(ConsumerClient_OnConsumeError) |
|
|
|
.Build(); |
|
|
|
} |
|
|
|
|
|
|
|
private void ConsumerClient_OnConsumeError(IConsumer<string, byte[]> consumer, Error e) |
|
|
|
{ |
|
|
|
var logArgs = new LogMessageEventArgs |
|
|
|