Skip to content

Commit

Permalink
Remove correlation ID header setting from dispatch
Browse files Browse the repository at this point in the history
Simplified the workflow dispatching process by removing the redundant setting of the X-Correlation-ID header in two places. This change should improve code readability and maintainability.
  • Loading branch information
sfmskywalker committed Sep 5, 2024
1 parent 0c10d54 commit 320bbdf
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ await sendEndpoint.Send(new DispatchWorkflowInstance(request.InstanceId)
CorrelationId = request.CorrelationId,
Input = request.Input,
Properties = request.Properties
},
x =>
{
if (request.CorrelationId != null) x.Headers.Set("X-Correlation-ID", request.CorrelationId);
}, cancellationToken);
return DispatchWorkflowResponse.Success();
}
Expand Down Expand Up @@ -132,10 +128,7 @@ private async Task DispatchWorkflowAsync(Workflow workflow, WorkflowInstanceOpti
var workflowInstance = await workflowInstanceManager.CreateWorkflowInstanceAsync(workflow, workflowInstanceOptions, cancellationToken);
var sendEndpoint = await GetSendEndpointAsync(options);
var message = DispatchWorkflowDefinition.DispatchExistingWorkflowInstance(workflowInstance.Id, triggerActivityId);
await sendEndpoint.Send(message, x =>
{
if (workflowInstanceOptions?.CorrelationId != null) x.Headers.Set("X-Correlation-ID", workflowInstanceOptions.CorrelationId);
}, cancellationToken);
await sendEndpoint.Send(message, cancellationToken);
}

private async Task DispatchBookmarksAsync(DispatchTriggerWorkflowsRequest request, DispatchWorkflowOptions? options = default, CancellationToken cancellationToken = default)
Expand Down

0 comments on commit 320bbdf

Please sign in to comment.