Interface IKafkaTestingHelper
Inherited Members
Namespace: Silverback.Testing
Assembly: Silverback.Integration.Kafka.Testing.dll
Syntax
public interface IKafkaTestingHelper : ITestingHelper<KafkaBroker>
Methods
| Improve this doc View sourceGetTopic(String)
Returns the IInMemoryTopic with the specified name.
Declaration
IInMemoryTopic GetTopic(string name)
Parameters
Type | Name | Description |
---|---|---|
System.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>).
GetTopic(String, String)
Returns the IInMemoryTopic with the specified name.
Declaration
IInMemoryTopic GetTopic(string name, string bootstrapServers)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the topic. |
System.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>).
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 |
---|---|---|
System.String | name | The name of the topic. |
System.String | bootstrapServers | The bootstrap servers string used to identify the target broker. |
Returns
Type | Description |
---|---|
System.Collections.Generic.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>).
WaitUntilAllMessagesAreConsumedAsync(Boolean, IReadOnlyCollection<String>, Nullable<TimeSpan>)
Returns a System.Threading.Tasks.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 |
---|---|---|
System.Boolean | throwTimeoutException | A value specifying whether a System.TimeoutException has to be thrown when the messages aren't consumed before the timeout expires. |
System.Collections.Generic.IReadOnlyCollection<System.String> | topicNames | The name of the topics to be monitored. |
System.Nullable<System.TimeSpan> | timeout | The time to wait for the messages to be consumed and processed. The default is 30 seconds. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.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>).
WaitUntilAllMessagesAreConsumedAsync(IReadOnlyCollection<String>, Nullable<TimeSpan>)
Returns a System.Threading.Tasks.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 |
---|---|---|
System.Collections.Generic.IReadOnlyCollection<System.String> | topicNames | The name of the topics to be monitored. |
System.Nullable<System.TimeSpan> | timeout | The time to wait for the messages to be consumed and processed. The default is 30 seconds. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.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>).