Skip to content

Commit

Permalink
chore: add WithClientTimeout to TopicConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
pgautier404 committed Sep 14, 2023
1 parent 52a4310 commit 036296b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
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

0 comments on commit 036296b

Please sign in to comment.