Skip to content

Commit

Permalink
refactor(multitenancy): Move ITenantIdsCommandStep to before final step.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnAbshire committed Nov 18, 2023
1 parent 506a575 commit 4eafab4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Client.UnitTests/ActivateJobTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ public async Task ShouldSendRequestWithTenantIdsListReceiveResponseAsExpected()

// when
var response = await ZeebeClient.NewActivateJobsCommand()
.AddTenantIds(tenantIds)
.JobType("foo")
.MaxJobsToActivate(1)
.Timeout(TimeSpan.FromSeconds(10))
.WorkerName("jobWorker")
.PollingTimeout(TimeSpan.FromSeconds(5))
.TenantIds(tenantIds)
.Send();

// then
Expand Down
4 changes: 2 additions & 2 deletions Client/Api/Commands/IActivateJobsCommandStep1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace Zeebe.Client.Api.Commands
{
public interface IActivateJobsCommandStep1 : ITenantIdsCommandStep<IActivateJobsCommandStep1>
public interface IActivateJobsCommandStep1
{
/// <summary>
/// Set the type of jobs to work on.
Expand All @@ -39,7 +39,7 @@ public interface IActivateJobsCommandStep2
IActivateJobsCommandStep3 MaxJobsToActivate(int maxJobsToActivate);
}

public interface IActivateJobsCommandStep3 : IFinalCommandWithRetryStep<IActivateJobsResponse>
public interface IActivateJobsCommandStep3 : ITenantIdsCommandStep<IActivateJobsCommandStep3>, IFinalCommandWithRetryStep<IActivateJobsResponse>
{
/// <summary>
/// Set the time for how long a job is exclusively assigned for this subscription.
Expand Down
4 changes: 2 additions & 2 deletions Client/Api/Commands/ITenantIdsCommandStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ public interface ITenantIdsCommandStep<out T>
/// <param name="tenantIds">the tenant to associate to this resource.</param>
/// <returns>The builder for this command. Call <see cref="IFinalCommandStep{T}.Send"/> to complete the command and send it
/// to the broker.</returns>
T AddTenantIds(IList<string> tenantIds);
T TenantIds(IList<string> tenantIds);

/// <summary>
/// Set a list of tenantIds to associate to this resource.
/// </summary>
/// <param name="tenantIds">the tenant to associate to this resource.</param>
/// <returns>The builder for this command. Call <see cref="IFinalCommandStep{T}.Send"/> to complete the command and send it
/// to the broker.</returns>
T AddTenantIds(params string[] tenantIds);
T TenantIds(params string[] tenantIds);
}
}
28 changes: 14 additions & 14 deletions Client/Impl/Commands/ActivateJobsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,6 @@ public IActivateJobsCommandStep2 JobType(string jobType)
return this;
}

public IActivateJobsCommandStep1 AddTenantIds(IList<string> tenantIds)
{
Request.TenantIds.AddRange(tenantIds);

return this;
}

public IActivateJobsCommandStep1 AddTenantIds(params string[] tenantIds)
{
Request.TenantIds.AddRange(tenantIds);

return this;
}

public IActivateJobsCommandStep3 MaxJobsToActivate(int maxJobsToActivate)
{
Request.MaxJobsToActivate = maxJobsToActivate;
Expand Down Expand Up @@ -79,6 +65,20 @@ public IActivateJobsCommandStep3 WorkerName(string workerName)
return this;
}

public IActivateJobsCommandStep3 TenantIds(IList<string> tenantIds)
{
Request.TenantIds.AddRange(tenantIds);

return this;
}

public IActivateJobsCommandStep3 TenantIds(params string[] tenantIds)
{
Request.TenantIds.AddRange(tenantIds);

return this;
}

public async Task<IActivateJobsResponse> Send(TimeSpan? timeout = null, CancellationToken token = default)
{
var activateJobsResponses = new Responses.ActivateJobsResponses();
Expand Down

0 comments on commit 4eafab4

Please sign in to comment.