Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions src/Abstractions/Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@
<ItemGroup>
<PackageReference Include="Microsoft.Azure.DurableTask.Core" Version="2.16.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../../src/Grpc/Grpc.csproj" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project should not reference gRPC. It is meant to be implementation agnostic.

</ItemGroup>

<ItemGroup>
<SharedSection Include="Core" />
<SharedSection Include="DependencyInjection" />
<SharedSection Include="Grpc" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions src/Abstractions/Internal/IOrchestrationSubmitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ 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 @@ -41,6 +40,5 @@ Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName,
object? input = null,
StartOrchestrationOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default);
}
8 changes: 6 additions & 2 deletions src/Abstractions/TaskOptions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Microsoft.DurableTask;
using P = Microsoft.DurableTask.Protobuf;

namespace Microsoft.DurableTask;
/// <summary>
/// Options that can be used to control the behavior of orchestrator task execution.
/// </summary>
Expand Down Expand Up @@ -100,4 +101,7 @@ public SubOrchestrationOptions(TaskOptions options, string? instanceId = null)
/// The time when the orchestration instance should start executing. If not specified or if a date-time in the past
/// is specified, the orchestration instance will be scheduled immediately.
/// </param>
public record StartOrchestrationOptions(string? InstanceId = null, DateTimeOffset? StartAt = null);
/// <param name="OrchestrationIdReusePolicy">The orchestration reuse policy. This allows for the reuse of an instance ID
/// as well as the options for it.</param>
public record StartOrchestrationOptions(string? InstanceId = null, DateTimeOffset? StartAt = null, Dictionary<P.OrchestrationStatus, P.CreateOrchestrationAction>?
OrchestrationIdReusePolicy = null);
21 changes: 6 additions & 15 deletions src/Client/Core/DurableTaskClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,20 @@ protected DurableTaskClient(string name)
public virtual DurableEntityClient Entities =>
throw new NotSupportedException($"{this.GetType()} does not support durable entities.");

/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)"/>
/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, CancellationToken)"/>
public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName, CancellationToken cancellation)
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, null, null, cancellation);
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, null, cancellation);

/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)"/>
/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, CancellationToken)"/>
public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName, object? input, CancellationToken cancellation)
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, input, null, null, cancellation);
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, input, null, cancellation);

/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)"/>
/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, CancellationToken)"/>
public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName, StartOrchestrationOptions options, CancellationToken cancellation = default)
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, options, null, cancellation);

/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)"/>
public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName, StartOrchestrationOptions options, HashSet<string> orchestrationIdReusePolicy, CancellationToken cancellation = default)
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, null, orchestrationIdReusePolicy, cancellation);
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, options, cancellation);

/// <summary>
/// Schedules a new orchestration instance for execution.
Expand Down Expand Up @@ -101,9 +96,6 @@ 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 @@ -118,7 +110,6 @@ 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: 2 additions & 4 deletions src/Client/Core/Entities/DurableEntityClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ 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 @@ -40,7 +39,6 @@ public abstract Task SignalEntityAsync(
string operationName,
object? input = null,
SignalEntityOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default);

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

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

/// <summary>
/// Tries to get the entity with ID of <paramref name="id"/>. Includes entity state by default.
Expand Down
1 change: 0 additions & 1 deletion src/Client/Grpc/GrpcDurableEntityClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ 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
1 change: 0 additions & 1 deletion src/Client/Grpc/GrpcDurableTaskClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ 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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ The client is responsible for interacting with orchestrations from outside the w
<EnableStyleCop>true</EnableStyleCop>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these packages needed for?

<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
</ItemGroup>

<PropertyGroup>
<!-- We are still working on this package for entities preview. -->
<VersionPrefix>1.0.5</VersionPrefix>
Expand All @@ -17,11 +22,13 @@ The client is responsible for interacting with orchestrations from outside the w

<ItemGroup>
<ProjectReference Include="../Core/Client.csproj" />
<ProjectReference Include="../../Grpc/Grpc.csproj" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't be depending on gRPC

</ItemGroup>

<ItemGroup>
<SharedSection Include="Core" />
<SharedSection Include="DependencyInjection" />
<SharedSection Include="Grpc" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
using Core = DurableTask.Core;
using CoreOrchestrationQuery = DurableTask.Core.Query.OrchestrationQuery;

using P = Microsoft.DurableTask.Protobuf;

namespace Microsoft.DurableTask.Client.OrchestrationServiceClientShim;

/// <summary>
Expand Down Expand Up @@ -130,11 +132,11 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName,
object? input = null,
StartOrchestrationOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default)
{
cancellation.ThrowIfCancellationRequested();
string instanceId = options?.InstanceId ?? Guid.NewGuid().ToString("N");
Dictionary<P.OrchestrationStatus, P.CreateOrchestrationAction> idReusePolicy = options?.OrchestrationIdReusePolicy ?? new Dictionary<P.OrchestrationStatus, P.CreateOrchestrationAction>();
OrchestrationInstance instance = new()
{
InstanceId = instanceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ 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