Show / Hide Table of Contents

    Interface IKafkaTestingHelper

    Exposes some helper methods and shortcuts to simplify testing.

    Inherited Members
    ITestingHelper<KafkaBroker>.Broker
    ITestingHelper<KafkaBroker>.Spy
    ITestingHelper<KafkaBroker>.WaitUntilConnectedAsync(TimeSpan?)
    ITestingHelper<KafkaBroker>.WaitUntilConnectedAsync(bool, TimeSpan?)
    ITestingHelper<KafkaBroker>.WaitUntilAllMessagesAreConsumedAsync(TimeSpan?)
    ITestingHelper<KafkaBroker>.WaitUntilAllMessagesAreConsumedAsync(bool, TimeSpan?)
    ITestingHelper<KafkaBroker>.WaitUntilOutboxIsEmptyAsync(CancellationToken)
    ITestingHelper<KafkaBroker>.IsOutboxEmptyAsync()
    Namespace: Silverback.Testing
    Assembly: Silverback.Integration.Kafka.Testing.dll
    Syntax
    public interface IKafkaTestingHelper : ITestingHelper<KafkaBroker>

    Methods

    | Improve this doc View source

    GetTopic(string)

    Returns the IInMemoryTopic with the specified name.

    Declaration
    IInMemoryTopic GetTopic(string name)
    Parameters
    Type Name Description
    string name

    The name of the topic.

    Returns
    Type Description
    IInMemoryTopic

    The IInMemoryTopic.

    Remarks

    This method works with the mocked Kafka broker only. See UseMockedKafka(ISilverbackBuilder, Action<IMockedKafkaOptionsBuilder>?) or AddMockedKafka(IBrokerOptionsBuilder, Action<IMockedKafkaOptionsBuilder>?).

    | Improve this doc View source

    GetTopic(string, string)

    Returns the IInMemoryTopic with the specified name.

    Declaration
    IInMemoryTopic GetTopic(string name, string bootstrapServers)
    Parameters
    Type Name Description
    string name

    The name of the topic.

    string bootstrapServers

    The bootstrap servers string used to identify the target broker.

    Returns
    Type Description
    IInMemoryTopic

    The IInMemoryTopic.

    Remarks

    This method works with the mocked Kafka broker only. See UseMockedKafka(ISilverbackBuilder, Action<IMockedKafkaOptionsBuilder>?) or AddMockedKafka(IBrokerOptionsBuilder, Action<IMockedKafkaOptionsBuilder>?).

    | Improve this doc View source

    GetTopics(string, string?)

    Returns the collection of IInMemoryTopic with the specified name.

    Declaration
    IReadOnlyCollection<IInMemoryTopic> GetTopics(string name, string? bootstrapServers = null)
    Parameters
    Type Name Description
    string name

    The name of the topic.

    string bootstrapServers

    The bootstrap servers string used to identify the target broker.

    Returns
    Type Description
    IReadOnlyCollection<IInMemoryTopic>

    The collection of IInMemoryTopic.

    Remarks

    This method works with the mocked Kafka broker only. See UseMockedKafka(ISilverbackBuilder, Action<IMockedKafkaOptionsBuilder>?) or AddMockedKafka(IBrokerOptionsBuilder, Action<IMockedKafkaOptionsBuilder>?).

    | Improve this doc View source

    WaitUntilAllMessagesAreConsumedAsync(bool, IReadOnlyCollection<string>, TimeSpan?)

    Returns a Task that completes when all messages routed to the consumers have been processed and committed.

    Declaration
    Task WaitUntilAllMessagesAreConsumedAsync(bool throwTimeoutException, IReadOnlyCollection<string> topicNames, TimeSpan? timeout = null)
    Parameters
    Type Name Description
    bool throwTimeoutException

    A value specifying whether a TimeoutException has to be thrown when the messages aren't consumed before the timeout expires.

    IReadOnlyCollection<string> topicNames

    The name of the topics to be monitored.

    TimeSpan? timeout

    The time to wait for the messages to be consumed and processed. The default is 30 seconds.

    Returns
    Type Description
    Task

    A Task that completes when all messages have been processed.

    Remarks

    This method works with the mocked Kafka broker only. See UseMockedKafka(ISilverbackBuilder, Action<IMockedKafkaOptionsBuilder>?) or AddMockedKafka(IBrokerOptionsBuilder, Action<IMockedKafkaOptionsBuilder>?).

    | Improve this doc View source

    WaitUntilAllMessagesAreConsumedAsync(IReadOnlyCollection<string>, TimeSpan?)

    Returns a Task that completes when all messages routed to the consumers have been processed and committed.

    Declaration
    Task WaitUntilAllMessagesAreConsumedAsync(IReadOnlyCollection<string> topicNames, TimeSpan? timeout = null)
    Parameters
    Type Name Description
    IReadOnlyCollection<string> topicNames

    The name of the topics to be monitored.

    TimeSpan? timeout

    The time to wait for the messages to be consumed and processed. The default is 30 seconds.

    Returns
    Type Description
    Task

    A Task that completes when all messages have been processed.

    Remarks

    This method works with the mocked Kafka broker only. See UseMockedKafka(ISilverbackBuilder, Action<IMockedKafkaOptionsBuilder>?) or AddMockedKafka(IBrokerOptionsBuilder, Action<IMockedKafkaOptionsBuilder>?).

    • Improve this doc
    • View source
    GitHub E-Mail
    ↑ Back to top © 2020 Sergio Aquilini