Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add WithClientTimeout to TopicConfiguration #494

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Momento.Sdk/Config/ITopicConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using Microsoft.Extensions.Logging;
using Momento.Sdk.Config.Transport;

Expand All @@ -20,4 +21,12 @@ public interface ITopicConfiguration
/// <param name="transportStrategy">This is responsible for configuring network tunables.</param>
/// <returns>Configuration object with custom transport strategy provided</returns>
public ITopicConfiguration WithTransportStrategy(ITopicTransportStrategy transportStrategy);

/// <summary>
/// Add the specified client timeout to an existing instance of TopicConfiguration object as an addiion to
/// the existing transport strategy.
/// </summary>
/// <param name="clientTimeout">The amount of time to wait before cancelling the request.</param>
/// <returns>TopicConfiguration object with client timeout provided</returns>
public ITopicConfiguration WithClientTimeout(TimeSpan clientTimeout);
}
10 changes: 10 additions & 0 deletions src/Momento.Sdk/Config/TopicConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using Microsoft.Extensions.Logging;
using Momento.Sdk.Config.Transport;

Expand Down Expand Up @@ -29,6 +30,15 @@ public ITopicConfiguration WithTransportStrategy(ITopicTransportStrategy transpo
return new TopicConfiguration(LoggerFactory, transportStrategy);
}

/// <inheritdoc/>
public ITopicConfiguration WithClientTimeout(TimeSpan clientTimeout)
{
return new TopicConfiguration(
loggerFactory: LoggerFactory,
transportStrategy: TransportStrategy.WithClientTimeout(clientTimeout)
);
}

/// <inheritdoc />
public override bool Equals(object obj)
{
Expand Down
Loading