< Summary - AsyncResponse (Release / net8.0+net10.0 / unit+integration)

Information
Class: AsyncResponse.Transports.Kafka.KafkaTransportTopicSchema
Assembly: AsyncResponse.Transports.Kafka
File(s): /home/runner/work/AsyncResponse/AsyncResponse/src/Transports/AsyncResponse.Transports.Kafka/KafkaTransportTopicSchema.cs
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 26
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_WorkerTopic()100%11100%
get_ResponseTopic()100%11100%
DeadLetterTopicFor(...)100%22100%
Resolve(...)100%22100%

File(s)

/home/runner/work/AsyncResponse/AsyncResponse/src/Transports/AsyncResponse.Transports.Kafka/KafkaTransportTopicSchema.cs

#LineLine coverage
 1namespace AsyncResponse.Transports.Kafka;
 2
 3/// <summary>
 4/// Resolves Kafka topic names from transport options. These names are deployment contracts:
 5/// changing them while messages are in flight strands unprocessed worker or response messages in
 6/// the old topic.
 7/// </summary>
 38internal sealed class KafkaTransportTopicSchema(KafkaAsyncResponseTransportOptions _options)
 9{
 310    public string WorkerTopic => Resolve(_options.WorkerTopic, "worker");
 311    public string ResponseTopic => Resolve(_options.ResponseTopic, "response");
 12
 13    /// <summary>
 14    /// The dead-letter topic for one source topic: the explicit <see cref="KafkaAsyncResponseTransportOptions.DeadLette
 15    /// when configured, otherwise <c>{sourceTopic}{DeadLetterTopicSuffix}</c>.
 16    /// </summary>
 17    public string DeadLetterTopicFor(string sourceTopic)
 318        => !string.IsNullOrWhiteSpace(_options.DeadLetterTopic)
 319            ? _options.DeadLetterTopic!
 320            : sourceTopic + _options.DeadLetterTopicSuffix;
 21
 22    private string Resolve(string? configured, string role)
 323        => !string.IsNullOrWhiteSpace(configured)
 324            ? configured!
 325            : $"{_options.TopicPrefix}.transport.{role}";
 26}