Skip to content
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

Allow multiple calls to SetStatisticsHandler / SetLogHandler / SetErrorHandler #2155

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -20,3 +20,4 @@ UpgradeLog*.htm
*~
\#*
core
.idea/
g7ed6e marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 3 additions & 3 deletions src/Confluent.Kafka/ConsumerBuilder.cs
Expand Up @@ -159,7 +159,7 @@ public ConsumerBuilder(IEnumerable<KeyValuePair<string, string>> config)
{
if (this.StatisticsHandler != null)
{
throw new InvalidOperationException("Statistics handler may not be specified more than once.");
this.StatisticsHandler += statisticsHandler;
g7ed6e marked this conversation as resolved.
Show resolved Hide resolved
}
this.StatisticsHandler = statisticsHandler;
g7ed6e marked this conversation as resolved.
Show resolved Hide resolved
return this;
Expand All @@ -182,7 +182,7 @@ public ConsumerBuilder(IEnumerable<KeyValuePair<string, string>> config)
{
if (this.ErrorHandler != null)
{
throw new InvalidOperationException("Error handler may not be specified more than once.");
this.ErrorHandler += errorHandler;
}
this.ErrorHandler = errorHandler;
return this;
Expand Down Expand Up @@ -212,7 +212,7 @@ public ConsumerBuilder(IEnumerable<KeyValuePair<string, string>> config)
{
if (this.LogHandler != null)
{
throw new InvalidOperationException("Log handler may not be specified more than once.");
this.LogHandler += logHandler;
}
this.LogHandler = logHandler;
return this;
Expand Down
6 changes: 3 additions & 3 deletions src/Confluent.Kafka/ProducerBuilder.cs
Expand Up @@ -169,7 +169,7 @@ public ProducerBuilder(IEnumerable<KeyValuePair<string, string>> config)
{
if (this.StatisticsHandler != null)
{
throw new InvalidOperationException("Statistics handler may not be specified more than once.");
this.StatisticsHandler += statisticsHandler;
}
this.StatisticsHandler = statisticsHandler;
return this;
Expand Down Expand Up @@ -224,7 +224,7 @@ public ProducerBuilder(IEnumerable<KeyValuePair<string, string>> config)
{
if (this.ErrorHandler != null)
{
throw new InvalidOperationException("Error handler may not be specified more than once.");
this.ErrorHandler += errorHandler;
}
this.ErrorHandler = errorHandler;
return this;
Expand Down Expand Up @@ -253,7 +253,7 @@ public ProducerBuilder(IEnumerable<KeyValuePair<string, string>> config)
{
if (this.LogHandler != null)
{
throw new InvalidOperationException("Log handler may not be specified more than once.");
this.LogHandler += logHandler;
}
this.LogHandler = logHandler;
return this;
Expand Down