Skip to content

Commit e235184

Browse files
committed
Merge branch 'main' into mediator
2 parents 3754340 + 22ce618 commit e235184

20 files changed

+1072
-78
lines changed

Microsoft.DurableTask.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shared", "src\Shared\Shared
5757
EndProject
5858
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "misc", "misc\misc.csproj", "{1E135970-60CF-470A-9270-4560BFA0A7DF}"
5959
EndProject
60+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client.OrchestrationServiceClientShim", "src\Client\OrchestrationServiceClientShim\Client.OrchestrationServiceClientShim.csproj", "{505F6151-6E36-4E0A-A740-14751B8A9397}"
61+
EndProject
62+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client.OrchestrationServiceClientShim.Tests", "test\Client\OrchestrationServiceClientShim.Tests\Client.OrchestrationServiceClientShim.Tests.csproj", "{93E3B973-0FC4-4241-B7BB-064FB538FB50}"
63+
EndProject
6064
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc", "src\Grpc\Grpc.csproj", "{44AD321D-96D4-481E-BD41-D0B12A619833}"
6165
EndProject
6266
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmarks", "test\Benchmarks\Benchmarks.csproj", "{82C0CD7D-2764-421A-8256-7E2304D5A6E7}"
@@ -147,6 +151,14 @@ Global
147151
{1E135970-60CF-470A-9270-4560BFA0A7DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
148152
{1E135970-60CF-470A-9270-4560BFA0A7DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
149153
{1E135970-60CF-470A-9270-4560BFA0A7DF}.Release|Any CPU.Build.0 = Release|Any CPU
154+
{505F6151-6E36-4E0A-A740-14751B8A9397}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
155+
{505F6151-6E36-4E0A-A740-14751B8A9397}.Debug|Any CPU.Build.0 = Debug|Any CPU
156+
{505F6151-6E36-4E0A-A740-14751B8A9397}.Release|Any CPU.ActiveCfg = Release|Any CPU
157+
{505F6151-6E36-4E0A-A740-14751B8A9397}.Release|Any CPU.Build.0 = Release|Any CPU
158+
{93E3B973-0FC4-4241-B7BB-064FB538FB50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
159+
{93E3B973-0FC4-4241-B7BB-064FB538FB50}.Debug|Any CPU.Build.0 = Debug|Any CPU
160+
{93E3B973-0FC4-4241-B7BB-064FB538FB50}.Release|Any CPU.ActiveCfg = Release|Any CPU
161+
{93E3B973-0FC4-4241-B7BB-064FB538FB50}.Release|Any CPU.Build.0 = Release|Any CPU
150162
{44AD321D-96D4-481E-BD41-D0B12A619833}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
151163
{44AD321D-96D4-481E-BD41-D0B12A619833}.Debug|Any CPU.Build.0 = Debug|Any CPU
152164
{44AD321D-96D4-481E-BD41-D0B12A619833}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -183,6 +195,8 @@ Global
183195
{8A0156E6-F033-49AB-AB0C-6698CE1DB24F} = {EFF7632B-821E-4CFC-B4A0-ED4B24296B17}
184196
{21AF0D71-6D32-483F-B6E8-3B28EE432560} = {EFF7632B-821E-4CFC-B4A0-ED4B24296B17}
185197
{57A4C812-B0D9-49E9-9EBE-7E94D3D78ED7} = {8AFC9781-F6F1-4696-BB4A-9ED7CA9D612B}
198+
{505F6151-6E36-4E0A-A740-14751B8A9397} = {1C217BB2-CE16-41CC-9D47-0FC0DB60BDB3}
199+
{93E3B973-0FC4-4241-B7BB-064FB538FB50} = {5AD837BC-78F3-4543-8AA3-DF74D0DF94C0}
186200
{44AD321D-96D4-481E-BD41-D0B12A619833} = {8AFC9781-F6F1-4696-BB4A-9ED7CA9D612B}
187201
{82C0CD7D-2764-421A-8256-7E2304D5A6E7} = {E5637F81-2FB9-4CD7-900D-455363B142A7}
188202
EndGlobalSection

src/Client/Core/Client.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ The client is responsible for interacting with orchestrations from outside the w
2121
<ProjectReference Include="../../Abstractions/Abstractions.csproj" />
2222
</ItemGroup>
2323

24+
<ItemGroup>
25+
<SharedSection Include="DependencyInjection" />
26+
</ItemGroup>
27+
2428
</Project>

src/Client/Core/DependencyInjection/ServiceProviderExtensions.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/Client/Core/DurableTaskClient.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
using System.ComponentModel;
45
using Microsoft.DurableTask.Internal;
56

67
namespace Microsoft.DurableTask.Client;
@@ -73,7 +74,7 @@ public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
7374
/// and health of the backend task hub, and whether a start time was provided via <paramref name="options" />.
7475
/// </para><para>
7576
/// The task associated with this method completes after the orchestration instance was successfully scheduled. You
76-
/// can use the <see cref="GetInstancesAsync(string, bool, CancellationToken)"/> to query the status of the
77+
/// can use the <see cref="GetInstanceAsync(string, bool, CancellationToken)"/> to query the status of the
7778
/// scheduled instance, the <see cref="WaitForInstanceStartAsync(string, bool, CancellationToken)"/> method to wait
7879
/// for the instance to transition out of the <see cref="OrchestrationRuntimeStatus.Pending"/> status, or the
7980
/// <see cref="WaitForInstanceCompletionAsync(string, bool, CancellationToken)"/> method to wait for the instance to
@@ -270,7 +271,27 @@ public virtual Task ResumeInstanceAsync(string instanceId, CancellationToken can
270271
public abstract Task ResumeInstanceAsync(
271272
string instanceId, string? reason = null, CancellationToken cancellation = default);
272273

274+
/// <inheritdoc cref="GetInstanceAsync(string, bool, CancellationToken)"/>
275+
public virtual Task<OrchestrationMetadata?> GetInstanceAsync(
276+
string instanceId, CancellationToken cancellation)
277+
=> this.GetInstanceAsync(instanceId, false, cancellation);
278+
279+
/// <summary>
280+
/// Fetches orchestration instance metadata from the configured durable store.
281+
/// </summary>
282+
/// <remarks>
283+
/// You can use the <paramref name="getInputsAndOutputs"/> parameter to determine whether to fetch input and
284+
/// output data for the target orchestration instance. If your code doesn't require access to this data, it's
285+
/// recommended that you set this parameter to <c>false</c> to minimize the network bandwidth, serialization, and
286+
/// memory costs associated with fetching the instance metadata.
287+
/// </remarks>
288+
/// <inheritdoc cref="WaitForInstanceStartAsync(string, bool, CancellationToken)"/>
289+
public virtual Task<OrchestrationMetadata?> GetInstanceAsync(
290+
string instanceId, bool getInputsAndOutputs = false, CancellationToken cancellation = default)
291+
=> this.GetInstancesAsync(instanceId, getInputsAndOutputs, cancellation);
292+
273293
/// <inheritdoc cref="GetInstancesAsync(string, bool, CancellationToken)"/>
294+
[EditorBrowsable(EditorBrowsableState.Never)] // use GetInstanceAsync
274295
public virtual Task<OrchestrationMetadata?> GetInstancesAsync(
275296
string instanceId, CancellationToken cancellation)
276297
=> this.GetInstancesAsync(instanceId, false, cancellation);
@@ -285,6 +306,7 @@ public abstract Task ResumeInstanceAsync(
285306
/// memory costs associated with fetching the instance metadata.
286307
/// </remarks>
287308
/// <inheritdoc cref="WaitForInstanceStartAsync(string, bool, CancellationToken)"/>
309+
[EditorBrowsable(EditorBrowsableState.Never)] // use GetInstanceAsync
288310
public abstract Task<OrchestrationMetadata?> GetInstancesAsync(
289311
string instanceId, bool getInputsAndOutputs = false, CancellationToken cancellation = default);
290312

src/Client/Core/OrchestrationRuntimeStatus.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public enum OrchestrationRuntimeStatus
4646
Pending,
4747

4848
/// <summary>
49-
/// The orchestration is in a suspended state.
49+
/// The orchestration has been suspended.
5050
/// </summary>
5151
Suspended,
5252
}

src/Client/Grpc/Client.Grpc.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
<ItemGroup>
2525
<SharedSection Include="Core" />
26+
<SharedSection Include="DependencyInjection" />
2627
<SharedSection Include="Grpc" />
2728
</ItemGroup>
2829

src/Client/Grpc/DependencyInjection/DurableTaskClientBuilderExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public static IDurableTaskClientBuilder UseGrpc(this IDurableTaskClientBuilder b
5858
public static IDurableTaskClientBuilder UseGrpc(
5959
this IDurableTaskClientBuilder builder, Action<GrpcDurableTaskClientOptions> configure)
6060
{
61+
Check.NotNull(builder);
62+
Check.NotNull(configure);
6163
builder.Services.Configure(builder.Name, configure);
6264
return builder.UseBuildTarget<GrpcDurableTaskClient, GrpcDurableTaskClientOptions>();
6365
}

src/Client/Grpc/DependencyInjection/ServiceProviderExtensions.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/Client/Grpc/GrpcDurableTaskClient.cs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,8 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync(
9595
public override async Task RaiseEventAsync(
9696
string instanceId, string eventName, object? eventPayload = null, CancellationToken cancellation = default)
9797
{
98-
if (string.IsNullOrEmpty(instanceId))
99-
{
100-
throw new ArgumentNullException(nameof(instanceId));
101-
}
102-
103-
if (string.IsNullOrEmpty(eventName))
104-
{
105-
throw new ArgumentNullException(nameof(eventName));
106-
}
98+
Check.NotNullOrEmpty(instanceId);
99+
Check.NotNullOrEmpty(eventName);
107100

108101
P.RaiseEventRequest request = new()
109102
{
@@ -119,11 +112,7 @@ public override async Task RaiseEventAsync(
119112
public override async Task TerminateInstanceAsync(
120113
string instanceId, object? output = null, CancellationToken cancellation = default)
121114
{
122-
if (string.IsNullOrEmpty(instanceId))
123-
{
124-
throw new ArgumentNullException(nameof(instanceId));
125-
}
126-
115+
Check.NotNullOrEmpty(instanceId);
127116
this.logger.TerminatingInstance(instanceId);
128117

129118
string? serializedOutput = this.DataConverter.Serialize(output);
@@ -148,8 +137,7 @@ public override async Task SuspendInstanceAsync(
148137

149138
try
150139
{
151-
await this.sidecarClient.SuspendInstanceAsync(
152-
request, cancellationToken: cancellation);
140+
await this.sidecarClient.SuspendInstanceAsync(request, cancellationToken: cancellation);
153141
}
154142
catch (RpcException e) when (e.StatusCode == StatusCode.Cancelled)
155143
{
@@ -170,8 +158,7 @@ public override async Task ResumeInstanceAsync(
170158

171159
try
172160
{
173-
await this.sidecarClient.ResumeInstanceAsync(
174-
request, cancellationToken: cancellation);
161+
await this.sidecarClient.ResumeInstanceAsync(request, cancellationToken: cancellation);
175162
}
176163
catch (RpcException e) when (e.StatusCode == StatusCode.Cancelled)
177164
{
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<PackageDescription>The compatibility shim client for the Durable Task Framework. Allows for using a `IOrchestrationServiceClient` directly.
6+
7+
The client is responsible for interacting with orchestrations from outside the worker.</PackageDescription>
8+
<EnableStyleCop>true</EnableStyleCop>
9+
</PropertyGroup>
10+
11+
<!-- Version info -->
12+
<PropertyGroup>
13+
<VersionPrefix>1.0.0</VersionPrefix>
14+
<VersionSuffix>rc.1</VersionSuffix>
15+
</PropertyGroup>
16+
17+
<ItemGroup>
18+
<ProjectReference Include="../Core/Client.csproj" />
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<SharedSection Include="Core" />
23+
<SharedSection Include="DependencyInjection" />
24+
</ItemGroup>
25+
26+
</Project>

0 commit comments

Comments
 (0)