Skip to content

Commit 4dc0ef8

Browse files
committed
Make consturctor of Kafka publisher more readable
1 parent 844bf05 commit 4dc0ef8

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/Motor.Extensions.Hosting.Kafka/KafkaMessageConsumer.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,17 @@ public KafkaMessageConsumer(
4747
CloudEventFormatter cloudEventFormatter
4848
)
4949
{
50-
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
50+
ArgumentNullException.ThrowIfNull(logger);
51+
ArgumentNullException.ThrowIfNull(config.Value);
52+
ArgumentNullException.ThrowIfNull(applicationNameService);
53+
ArgumentNullException.ThrowIfNull(cloudEventFormatter);
54+
55+
_logger = logger;
5156
_applicationLifetime = applicationLifetime;
52-
_applicationNameService =
53-
applicationNameService ?? throw new ArgumentNullException(nameof(applicationNameService));
57+
_applicationNameService = applicationNameService;
5458
_cloudEventFormatter = cloudEventFormatter;
55-
_options = config.Value ?? throw new ArgumentNullException(nameof(config));
59+
_options = config.Value;
60+
5661
_consumerLagSummary = metricsFactory?.CreateSummary(
5762
"consumer_lag_distribution",
5863
"Contains a summary of current consumer lag of each partition",

0 commit comments

Comments
 (0)