Summary
The .NET Durable Execution SDK does not appear to expose virtual-context support directly on IDurableContext.RunInChildContextAsync.
Virtual contexts are available through concurrent operations via MapConfig.NestingType = NestingType.Flat and ParallelConfig.NestingType = NestingType.Flat, but there is no equivalent option on ChildContextConfig for a standalone RunInChildContextAsync operation.
Why this matters
The Java Durable Execution SDK supports this directly:
context.runInChildContextAsync(
"order-validation",
String.class,
child -> { ... },
RunInChildContextConfig.builder().isVirtual(true).build());
That makes it possible to create individual virtual child contexts, including when users manually fan out work and collect the returned futures.
In the .NET SDK, code that wants the same shape currently has to switch to MapAsync or ParallelAsync with NestingType.Flat. That works for batch-shaped workloads, but it is less direct when porting Java examples or when the workflow naturally wants to compose standalone child contexts with RunInChildContextAsync and Task.WhenAll.
Current .NET behavior
RunInChildContextAsync accepts ChildContextConfig, but ChildContextConfig does not expose a virtual/flat nesting option.
The SDK internals appear to support virtual child contexts already. For example, ChildContextOperation has an isVirtual path, and concurrent operations use it when NestingType.Flat is configured. The missing piece seems to be public API surface for standalone child contexts.
Requested behavior
Please consider adding a virtual-context option to standalone child context configuration, for example:
await context.RunInChildContextAsync(
async (childContext, cancellationToken) =>
{
return await childContext.StepAsync(
(_, stepCancellationToken) => Task.FromResult("result"),
name: "compute",
cancellationToken: cancellationToken);
},
name: "child-0",
config: new ChildContextConfig
{
NestingType = NestingType.Flat
});
or:
config: new ChildContextConfig
{
IsVirtual = true
}
Workaround
For batch workloads, MapAsync or ParallelAsync with NestingType.Flat can provide virtual contexts:
await context.MapAsync(
items,
async (itemContext, item, index, allItems, cancellationToken) =>
await itemContext.StepAsync(
(_, stepCancellationToken) => Task.FromResult(index),
name: $"compute-{index}",
cancellationToken: cancellationToken),
config: new MapConfig
{
NestingType = NestingType.Flat
});
This is useful, but it does not cover the standalone RunInChildContextAsync parity case.
Summary
The .NET Durable Execution SDK does not appear to expose virtual-context support directly on
IDurableContext.RunInChildContextAsync.Virtual contexts are available through concurrent operations via
MapConfig.NestingType = NestingType.FlatandParallelConfig.NestingType = NestingType.Flat, but there is no equivalent option onChildContextConfigfor a standaloneRunInChildContextAsyncoperation.Why this matters
The Java Durable Execution SDK supports this directly:
That makes it possible to create individual virtual child contexts, including when users manually fan out work and collect the returned futures.
In the .NET SDK, code that wants the same shape currently has to switch to
MapAsyncorParallelAsyncwithNestingType.Flat. That works for batch-shaped workloads, but it is less direct when porting Java examples or when the workflow naturally wants to compose standalone child contexts withRunInChildContextAsyncandTask.WhenAll.Current .NET behavior
RunInChildContextAsyncacceptsChildContextConfig, butChildContextConfigdoes not expose a virtual/flat nesting option.The SDK internals appear to support virtual child contexts already. For example,
ChildContextOperationhas anisVirtualpath, and concurrent operations use it whenNestingType.Flatis configured. The missing piece seems to be public API surface for standalone child contexts.Requested behavior
Please consider adding a virtual-context option to standalone child context configuration, for example:
or:
Workaround
For batch workloads,
MapAsyncorParallelAsyncwithNestingType.Flatcan provide virtual contexts:This is useful, but it does not cover the standalone
RunInChildContextAsyncparity case.