forked from elsa-workflows/elsa-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add IExecuteWorkflowApi interface and refine retry policy configuration
A new interface, IExecuteWorkflowApi, was created to handle execution and dispatch of workflow definitions. This breaks down functionalities previously present in IWorkflowDefinitionsApi. Also, the retry policy configuration for HTTP requests has been refactored. Instead of hardcoding retry settings, now a delegate method can be optionally passed to customize the behavior. This makes it more flexible and shifts the responsibility of configuring retry policies to the client.
- Loading branch information
1 parent
c750686
commit 53bd1f9
Showing
4 changed files
with
61 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/clients/Elsa.Api.Client/Resources/WorkflowDefinitions/Contracts/IExecuteWorkflowApi.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Elsa.Api.Client.Resources.WorkflowDefinitions.Requests; | ||
using JetBrains.Annotations; | ||
using Refit; | ||
|
||
namespace Elsa.Api.Client.Resources.WorkflowDefinitions.Contracts; | ||
|
||
/// <summary> | ||
/// Represents a client for the workflow definitions API. | ||
/// </summary> | ||
[PublicAPI] | ||
public interface IExecuteWorkflowApi | ||
{ | ||
/// <summary> | ||
/// Executes a workflow definition. | ||
/// </summary> | ||
/// <param name="definitionId">The definition ID of the workflow definition to execute.</param> | ||
/// <param name="request">An optional request containing options for executing the workflow definition.</param> | ||
/// <param name="cancellationToken">An optional cancellation token.</param> | ||
/// <returns>A response containing information about the workflow instance that was created.</returns> | ||
[Post("/workflow-definitions/{definitionId}/execute")] | ||
Task<HttpResponseMessage> ExecuteAsync(string definitionId, ExecuteWorkflowDefinitionRequest? request, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Dispatches a request to execute the specified workflow definition. | ||
/// </summary> | ||
/// <param name="definitionId">The definition ID of the workflow definition to dispatch request.</param> | ||
/// <param name="request">An optional request containing options for dispatching a request to execute the specified workflow definition.</param> | ||
/// <param name="cancellationToken">An optional cancellation token.</param> | ||
/// <returns>A response containing information about the workflow instance that was created.</returns> | ||
[Post("/workflow-definitions/{definitionId}/dispatch")] | ||
Task<HttpResponseMessage> DispatchAsync(string definitionId, DispatchWorkflowDefinitionRequest? request, CancellationToken cancellationToken = default); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters