Interface IMockedKafkaOptionsBuilder
- Namespace
- Silverback.Messaging.Configuration.Kafka
- Assembly
- Silverback.Integration.Kafka.Testing.dll
Exposes the methods to configure the mocked Kafka.
public interface IMockedKafkaOptionsBuilder
Methods
DelayPartitionsAssignment(TimeSpan)
Specifies the delay to be applied before assigning the partitions.
IMockedKafkaOptionsBuilder DelayPartitionsAssignment(TimeSpan delay)
Parameters
delayTimeSpanThe delay to be applied before assigning the partitions.
Returns
- IMockedKafkaOptionsBuilder
The IMockedKafkaOptionsBuilder so that additional calls can be chained.
OverrideAutoCommitIntervalMs(int?)
Specifies the auto-commit interval in milliseconds to use in mocked consumers instead of
AutoCommitIntervalMs. The override is applied automatically and defaults to 50 milliseconds.
Set it to null to use the consumer's configured interval, or 5 seconds if no interval is configured.
IMockedKafkaOptionsBuilder OverrideAutoCommitIntervalMs(int? intervalMs)
Parameters
intervalMsint?The desired auto commit interval in milliseconds.
Returns
- IMockedKafkaOptionsBuilder
The IMockedKafkaOptionsBuilder so that additional calls can be chained.
Remarks
This override only affects consumers with auto-commit enabled and speeds up tests that wait for broker offset commits. WaitUntilAllMessagesAreConsumedAsync(params string[]) uses locally stored offsets and does not depend on this interval.
WithDefaultPartitionsCount(int)
Specifies the default number of partitions to be created per each topic. The default is 5.
IMockedKafkaOptionsBuilder WithDefaultPartitionsCount(int partitionsCount)
Parameters
partitionsCountintThe number of partitions.
Returns
- IMockedKafkaOptionsBuilder
The IMockedKafkaOptionsBuilder so that additional calls can be chained.
WithPartitionsCount(string, int)
Specifies the default number of partitions to be created for the topic.
IMockedKafkaOptionsBuilder WithPartitionsCount(string topicName, int partitionsCount)
Parameters
Returns
- IMockedKafkaOptionsBuilder
The IMockedKafkaOptionsBuilder so that additional calls can be chained.