Skip to content

Commit

Permalink
Initial push for adding orchestration reuse ID
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Lettieri <[email protected]>
  • Loading branch information
RyanLettieri committed Jan 4, 2024
1 parent b12cd67 commit e3c1304
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion eng/proto
2 changes: 2 additions & 0 deletions src/Abstractions/Internal/IOrchestrationSubmitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public interface IOrchestrationSubmitter
/// The optional input to pass to the scheduled orchestration instance. This must be a serializable value.
/// </param>
/// <param name="options">The options to start the new orchestration with.</param>
/// <param name="orchestrationIdReusePolicy">The policy for reusing an orchestration ID.</param>
/// <param name="cancellation">
/// The cancellation token. This only cancels enqueueing the new orchestration to the backend. Does not cancel the
/// orchestration once enqueued.
Expand All @@ -40,5 +41,6 @@ Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName,
object? input = null,
StartOrchestrationOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default);
}
21 changes: 15 additions & 6 deletions src/Client/Core/DurableTaskClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,25 @@ protected DurableTaskClient(string name)
public virtual DurableEntityClient Entities =>
throw new NotSupportedException($"{this.GetType()} does not support durable entities.");

/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, CancellationToken)"/>
/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)"/>

Check warning on line 54 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

Invalid type for parameter HashSet in XML comment cref attribute: 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)'

Check warning on line 54 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)' that could not be resolved

Check warning on line 54 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

Invalid type for parameter HashSet in XML comment cref attribute: 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)'

Check warning on line 54 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)' that could not be resolved
public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName, CancellationToken cancellation)
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, null, cancellation);
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, null, null, cancellation);

/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, CancellationToken)"/>
/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)"/>

Check warning on line 59 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

Invalid type for parameter HashSet in XML comment cref attribute: 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)'

Check warning on line 59 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)' that could not be resolved
public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName, object? input, CancellationToken cancellation)
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, input, null, cancellation);
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, input, null, null, cancellation);

/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, CancellationToken)"/>
/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)"/>

Check warning on line 64 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

Invalid type for parameter HashSet in XML comment cref attribute: 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)'

Check warning on line 64 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)' that could not be resolved
public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName, StartOrchestrationOptions options, CancellationToken cancellation = default)
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, options, cancellation);
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, options, null, cancellation);

/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)"/>

Check warning on line 69 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

Invalid type for parameter HashSet in XML comment cref attribute: 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)'

Check warning on line 69 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)' that could not be resolved
public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName, StartOrchestrationOptions options, HashSet<string> orchestrationIdReusePolicy, CancellationToken cancellation = default)
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, null, orchestrationIdReusePolicy, cancellation);

/// <summary>
/// Schedules a new orchestration instance for execution.
Expand Down Expand Up @@ -96,6 +101,9 @@ public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
/// The optional input to pass to the scheduled orchestration instance. This must be a serializable value.
/// </param>
/// <param name="options">The options to start the new orchestration with.</param>
/// <param name="orchestrationIdReusePolicy">
/// The orchestration reuse policy. This allows for the reuse of an instance ID as well as the options for it.
/// </param>
/// <param name="cancellation">
/// The cancellation token. This only cancels enqueueing the new orchestration to the backend. Does not cancel the
/// orchestration once enqueued.
Expand All @@ -110,6 +118,7 @@ public abstract Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName,
object? input = null,
StartOrchestrationOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default);

/// <inheritdoc cref="RaiseEventAsync(string, string, object, CancellationToken)"/>
Expand Down
6 changes: 4 additions & 2 deletions src/Client/Core/Entities/DurableEntityClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ protected DurableEntityClient(string name)
/// <param name="operationName">The name of the operation.</param>
/// <param name="input">The input for the operation.</param>
/// <param name="options">The options to signal the entity with.</param>
/// <param name="orchestrationIdReusePolicy">The policy for reusing an orchestration ID.</param>
/// <param name="cancellation">The cancellation token to cancel enqueuing of the operation.</param>
/// <returns>A task that completes when the message has been reliably enqueued.</returns>
/// <remarks>This does not wait for the operation to be processed by the receiving entity.</remarks>
Expand All @@ -39,6 +40,7 @@ public abstract Task SignalEntityAsync(
string operationName,
object? input = null,
SignalEntityOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default);

/// <summary>
Expand All @@ -55,7 +57,7 @@ public virtual Task SignalEntityAsync(
string operationName,
SignalEntityOptions options,
CancellationToken cancellation = default)
=> this.SignalEntityAsync(id, operationName, null, options, cancellation);
=> this.SignalEntityAsync(id, operationName, null, options, null, cancellation);

/// <summary>
/// Signals an entity to perform an operation.
Expand All @@ -69,7 +71,7 @@ public virtual Task SignalEntityAsync(
EntityInstanceId id,
string operationName,
CancellationToken cancellation)
=> this.SignalEntityAsync(id, operationName, null, null, cancellation);
=> this.SignalEntityAsync(id, operationName, null, null, null, cancellation);

/// <summary>
/// Tries to get the entity with ID of <paramref name="id"/>. Includes entity state by default.
Expand Down
1 change: 1 addition & 0 deletions src/Client/Grpc/GrpcDurableEntityClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public override async Task SignalEntityAsync(
string operationName,
object? input = null,
SignalEntityOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default)
{
Check.NotNullOrEmpty(id.Name);
Expand Down
2 changes: 2 additions & 0 deletions src/Client/Grpc/GrpcDurableTaskClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName,
object? input = null,
StartOrchestrationOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default)
{
Check.NotEntity(this.options.EnableEntitySupport, options?.InstanceId);
Expand All @@ -83,6 +84,7 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync(
Version = orchestratorName.Version,
InstanceId = options?.InstanceId ?? Guid.NewGuid().ToString("N"),
Input = this.DataConverter.Serialize(input),
OrchestrationIdReusePolicy = { },
};

DateTimeOffset? startAt = options?.StartAt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName,
object? input = null,
StartOrchestrationOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default)
{
cancellation.ThrowIfCancellationRequested();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public override Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName,
object? input = null,
StartOrchestrationOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default)
{
throw new NotImplementedException();
Expand Down

0 comments on commit e3c1304

Please sign in to comment.