Add support for naming workflow instances during execution
This update introduces a `Name` property to workflow execution requests, allowing workflows to be named when started. The changes ensure the `Name` is propagated through the relevant services and endpoints, improving tracking and identification of workflow instances.
This commit is contained in:
parent
27fe72d123
commit
0ceeb801e7
|
|
@ -43,6 +43,7 @@ internal abstract class EndpointBase<T>(
|
|||
{
|
||||
Workflow = workflowGraph.Workflow,
|
||||
CorrelationId = request.CorrelationId,
|
||||
Name = request.Name,
|
||||
Input = request.GetInputAsDictionary(),
|
||||
TriggerActivityId = request.TriggerActivityId,
|
||||
ActivityHandle = request.ActivityHandle
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ public interface IExecutionRequest
|
|||
{
|
||||
string DefinitionId { get; }
|
||||
string? CorrelationId { get; }
|
||||
string? Name { get; }
|
||||
string? TriggerActivityId { get; }
|
||||
ActivityHandle? ActivityHandle { get; }
|
||||
VersionOptions? VersionOptions { get; }
|
||||
|
|
@ -22,8 +23,9 @@ public interface IExecutionRequest
|
|||
|
||||
public class PostRequest : IExecutionRequest
|
||||
{
|
||||
public string DefinitionId { get; set; } = default!;
|
||||
public string DefinitionId { get; set; } = null!;
|
||||
public string? CorrelationId { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? TriggerActivityId { get; set; }
|
||||
public ActivityHandle? ActivityHandle { get; set; }
|
||||
public VersionOptions? VersionOptions { get; set; }
|
||||
|
|
@ -36,8 +38,9 @@ public class PostRequest : IExecutionRequest
|
|||
|
||||
public class GetRequest : IExecutionRequest
|
||||
{
|
||||
public string DefinitionId { get; set; } = default!;
|
||||
public string DefinitionId { get; set; } = null!;
|
||||
public string? CorrelationId { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? TriggerActivityId { get; set; }
|
||||
public ActivityHandle? ActivityHandle { get; set; }
|
||||
public VersionOptions? VersionOptions { get; set; }
|
||||
|
|
@ -45,9 +48,9 @@ public class GetRequest : IExecutionRequest
|
|||
|
||||
public IDictionary<string, object>? GetInputAsDictionary()
|
||||
{
|
||||
var result = Input?.TryConvertTo<ExpandoObject>(new ObjectConverterOptions
|
||||
var result = Input?.TryConvertTo<ExpandoObject>(new()
|
||||
{
|
||||
SerializerOptions = new JsonSerializerOptions
|
||||
SerializerOptions = new()
|
||||
{
|
||||
Converters = { new ExpandoObjectConverter() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ public class StartWorkflowRequest
|
|||
/// </summary>
|
||||
public string? CorrelationId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name to use when starting a new workflow instance.
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The input to the workflow instance, if any.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ public class DefaultWorkflowStarter(IWorkflowDefinitionService workflowDefinitio
|
|||
{
|
||||
WorkflowDefinitionHandle = WorkflowDefinitionHandle.ByDefinitionVersionId(workflow.Identity.Id),
|
||||
CorrelationId = request.CorrelationId,
|
||||
Name = request.Name,
|
||||
Input = request.Input,
|
||||
TriggerActivityId = request.TriggerActivityId,
|
||||
ActivityHandle = request.ActivityHandle,
|
||||
|
|
|
|||
Loading…
Reference in a new issue