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(client): introduce new interface for sendWithRetry #232

Merged
merged 1 commit into from
Feb 26, 2021
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
2 changes: 1 addition & 1 deletion Client/Api/Commands/ICancelWorkflowInstanceCommandStep1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Zeebe.Client.Api.Commands
{
public interface ICancelWorkflowInstanceCommandStep1 : IFinalCommandStep<ICancelWorkflowInstanceResponse>
public interface ICancelWorkflowInstanceCommandStep1 : IFinalCommandWithRetryStep<ICancelWorkflowInstanceResponse>
{
// the place for new optional parameters
}
Expand Down
21 changes: 0 additions & 21 deletions Client/Api/Commands/IFinalCommandStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,5 @@ public interface IFinalCommandStep<T>
/// <param name="timeout">the time span after request should be timed out</param>
/// <returns>a task tracking state of success/failure of the command.</returns>
Task<T> Send(TimeSpan? timeout = null);

/// <summary>
/// Sends the command with retry to the Zeebe broker. This operation is asynchronous. In case of success, the
/// task returns the event that was generated by the Zeebe broker in response to the command.
/// If the sending of the command fails, because of broker back pressure or network issues the request is
/// retried until the command succeeds. The wait time between retries can be configured on the
/// ZeebeClientBuilder. Per default the wait time is based on power two, which means 2^1 seconds, 2^2 seconds
/// etc. until it reaches the maximum of one minute.
///
/// <para>Use <c>await ...SendWithRetry();</c> to wait until the response is available.</para>
///
/// <example>
/// <code>
/// T response = await command.SendWithRetry();
/// </code>
/// </example>
/// </summary>
///
/// <param name="timeout">the time span after request should be timed out</param>
/// <returns>a task tracking state of success/failure of the command.</returns>
Task<T> SendWithRetry(TimeSpan? timeout = null);
}
}
29 changes: 29 additions & 0 deletions Client/Api/Commands/IFinalCommandWithRetryStep.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Threading.Tasks;

namespace Zeebe.Client.Api.Commands
{
public interface IFinalCommandWithRetryStep<T> : IFinalCommandStep<T>
{
/// <summary>
/// Sends the command with retry to the Zeebe broker. This operation is asynchronous. In case of success, the
/// task returns the event that was generated by the Zeebe broker in response to the command.
/// If the sending of the command fails, because of broker back pressure or network issues the request is
/// retried until the command succeeds. The wait time between retries can be configured on the
/// ZeebeClientBuilder. Per default the wait time is based on power two, which means 2^1 seconds, 2^2 seconds
/// etc. until it reaches the maximum of one minute.
///
/// <para>Use <c>await ...SendWithRetry();</c> to wait until the response is available.</para>
///
/// <example>
/// <code>
/// T response = await command.SendWithRetry();
/// </code>
/// </example>
/// </summary>
///
/// <param name="timeout">the time span after request should be timed out</param>
/// <returns>a task tracking state of success/failure of the command.</returns>
Task<T> SendWithRetry(TimeSpan? timeout = null);
}
}
5 changes: 0 additions & 5 deletions Client/Impl/Commands/CompleteJobCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,5 @@ public async Task<ICompleteJobResponse> Send(TimeSpan? timeout = null)
await asyncReply.ResponseAsync;
return new Responses.CompleteJobResponse();
}

public Task<ICompleteJobResponse> SendWithRetry(TimeSpan? timespan = null)
{
throw new NotImplementedException();
}
}
}
5 changes: 0 additions & 5 deletions Client/Impl/Commands/CreateWorkflowInstanceCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,5 @@ public async Task<IWorkflowInstanceResponse> Send(TimeSpan? timeout = null)
var response = await asyncReply.ResponseAsync;
return new WorkflowInstanceResponse(response);
}

public Task<IWorkflowInstanceResponse> SendWithRetry(TimeSpan? timespan = null)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,5 @@ public async Task<IWorkflowInstanceResult> Send(TimeSpan? timeout = null)
var response = await asyncReply.ResponseAsync;
return new WorkflowInstanceResultResponse(response);
}

public Task<IWorkflowInstanceResult> SendWithRetry(TimeSpan? timespan = null)
{
throw new NotImplementedException();
}
}
}
5 changes: 0 additions & 5 deletions Client/Impl/Commands/DeployWorkflowCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,5 @@ private void AddWorkflow(ByteString resource, string resourceName)

request.Workflows.Add(requestObject);
}

public Task<IDeployResponse> SendWithRetry(TimeSpan? timespan = null)
{
throw new NotImplementedException();
}
}
}
5 changes: 0 additions & 5 deletions Client/Impl/Commands/FailJobCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,5 @@ public async Task<IFailJobResponse> Send(TimeSpan? timeout = null)
await asyncReply.ResponseAsync;
return new FailJobResponse();
}

public Task<IFailJobResponse> SendWithRetry(TimeSpan? timespan = null)
{
throw new NotImplementedException();
}
}
}
5 changes: 0 additions & 5 deletions Client/Impl/Commands/PublishMessageCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,5 @@ public async Task<IPublishMessageResponse> Send(TimeSpan? timeout = null)
await asyncReply.ResponseAsync;
return new PublishMessageResponse();
}

public Task<IPublishMessageResponse> SendWithRetry(TimeSpan? timespan = null)
{
throw new NotImplementedException();
}
}
}
5 changes: 0 additions & 5 deletions Client/Impl/Commands/ResolveIncidentCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,5 @@ public async Task<IResolveIncidentResponse> Send(TimeSpan? timeout = null)
await asyncReply.ResponseAsync;
return new ResolveIncidentResponse();
}

public Task<IResolveIncidentResponse> SendWithRetry(TimeSpan? timespan = null)
{
throw new NotImplementedException();
}
}
}
5 changes: 0 additions & 5 deletions Client/Impl/Commands/SetVariablesCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,5 @@ public async Task<ISetVariablesResponse> Send(TimeSpan? timeout = null)
var response = await asyncReply.ResponseAsync;
return new SetVariablesResponse(response);
}

public Task<ISetVariablesResponse> SendWithRetry(TimeSpan? timespan = null)
{
throw new NotImplementedException();
}
}
}
5 changes: 0 additions & 5 deletions Client/Impl/Commands/ThrowErrorCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,5 @@ public async Task<IThrowErrorResponse> Send(TimeSpan? timeout = null)
await asyncReply.ResponseAsync;
return new Responses.ThrowErrorResponse();
}

public Task<IThrowErrorResponse> SendWithRetry(TimeSpan? timespan = null)
{
throw new NotImplementedException();
}
}
}
5 changes: 0 additions & 5 deletions Client/Impl/Commands/TopologyRequestCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,5 @@ public async Task<ITopology> Send(TimeSpan? timeout = null)

return new Topology(response);
}

public Task<ITopology> SendWithRetry(TimeSpan? timespan = null)
{
throw new NotImplementedException();
}
}
}
5 changes: 0 additions & 5 deletions Client/Impl/Commands/UpdateRetriesCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,5 @@ public async Task<IUpdateRetriesResponse> Send(TimeSpan? timeout = null)
await asyncReply.ResponseAsync;
return new UpdateRetriesResponse();
}

public Task<IUpdateRetriesResponse> SendWithRetry(TimeSpan? timespan = null)
{
throw new NotImplementedException();
}
}
}
1 change: 0 additions & 1 deletion Client/ZeebeClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ internal ZeebeClient(string address,
new Channel(address, credentials, channelOptions);
gatewayClient = new Gateway.GatewayClient(channelToGateway);


asyncRetryStrategy =
new TransientGrpcErrorRetryStrategy(sleepDurationProvider ??
DefaultWaitTimeProvider);
Expand Down