Browse Source

Change Kafka BuildConsumer to return Consumer rather than set private _consumerClient (#990)

Co-authored-by: Unknown <email@example.co.uk>
master
Dan 3 years ago
committed by GitHub
parent
commit
42796c95b5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs

+ 3
- 3
src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs View File

@@ -153,7 +153,7 @@ namespace DotNetCore.CAP.Kafka
config.EnableAutoCommit ??= false; config.EnableAutoCommit ??= false;
config.LogConnectionClose ??= false; config.LogConnectionClose ??= false;


BuildConsumer(config);
_consumerClient = BuildConsumer(config);
} }
} }
finally finally
@@ -162,9 +162,9 @@ namespace DotNetCore.CAP.Kafka
} }
} }


protected virtual void BuildConsumer(ConsumerConfig config)
protected virtual IConsumer<string, byte[]> BuildConsumer(ConsumerConfig config)
{ {
_consumerClient = new ConsumerBuilder<string, byte[]>(config)
return new ConsumerBuilder<string, byte[]>(config)
.SetErrorHandler(ConsumerClient_OnConsumeError) .SetErrorHandler(ConsumerClient_OnConsumeError)
.Build(); .Build();
} }


Loading…
Cancel
Save