diff --git a/Directory.Packages.props b/Directory.Packages.props
index fe346ae0e..8f97a65f2 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -112,34 +112,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -168,5 +140,7 @@
+
+
\ No newline at end of file
diff --git a/samples/aspnet/Elsa.Samples.AspNet.EntityFrameworkCore.PostgresSql/Elsa.Samples.AspNet.EntityFrameworkCore.PostgresSql.csproj b/samples/aspnet/Elsa.Samples.AspNet.EntityFrameworkCore.PostgresSql/Elsa.Samples.AspNet.EntityFrameworkCore.PostgresSql.csproj
index b0593ffb9..ff765f2dc 100644
--- a/samples/aspnet/Elsa.Samples.AspNet.EntityFrameworkCore.PostgresSql/Elsa.Samples.AspNet.EntityFrameworkCore.PostgresSql.csproj
+++ b/samples/aspnet/Elsa.Samples.AspNet.EntityFrameworkCore.PostgresSql/Elsa.Samples.AspNet.EntityFrameworkCore.PostgresSql.csproj
@@ -1,7 +1,7 @@
- net7.0;net8.0
+ net8.0
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 843d67641..ca5601874 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -3,7 +3,7 @@
- net6.0;net7.0;net8.0
+ net8.0
diff --git a/src/bundles/Elsa.Server.LoadBalancer/Elsa.Server.LoadBalancer.csproj b/src/bundles/Elsa.Server.LoadBalancer/Elsa.Server.LoadBalancer.csproj
index ab5408636..90dec8fea 100644
--- a/src/bundles/Elsa.Server.LoadBalancer/Elsa.Server.LoadBalancer.csproj
+++ b/src/bundles/Elsa.Server.LoadBalancer/Elsa.Server.LoadBalancer.csproj
@@ -1,7 +1,7 @@
- net7.0;net8.0
+ net8.0
Linux
false
latest
diff --git a/src/bundles/Elsa.Server.Web/Elsa.Server.Web.csproj b/src/bundles/Elsa.Server.Web/Elsa.Server.Web.csproj
index 40bce5491..dd057dc90 100644
--- a/src/bundles/Elsa.Server.Web/Elsa.Server.Web.csproj
+++ b/src/bundles/Elsa.Server.Web/Elsa.Server.Web.csproj
@@ -1,7 +1,7 @@
- net7.0;net8.0
+ net8.0
Linux
false
latest
diff --git a/src/bundles/Elsa.ServerAndStudio.Web/Elsa.ServerAndStudio.Web.csproj b/src/bundles/Elsa.ServerAndStudio.Web/Elsa.ServerAndStudio.Web.csproj
index e2d1c97f8..5064e0750 100644
--- a/src/bundles/Elsa.ServerAndStudio.Web/Elsa.ServerAndStudio.Web.csproj
+++ b/src/bundles/Elsa.ServerAndStudio.Web/Elsa.ServerAndStudio.Web.csproj
@@ -1,7 +1,7 @@
- net7.0;net8.0
+ net8.0
Linux
false
diff --git a/src/bundles/Elsa.Studio.Web/Elsa.Studio.Web.csproj b/src/bundles/Elsa.Studio.Web/Elsa.Studio.Web.csproj
index 2cb27ad13..e425e69b4 100644
--- a/src/bundles/Elsa.Studio.Web/Elsa.Studio.Web.csproj
+++ b/src/bundles/Elsa.Studio.Web/Elsa.Studio.Web.csproj
@@ -1,7 +1,7 @@
- net7.0;net8.0
+ net8.0
Linux
false
diff --git a/src/bundles/ElsaStudioWebAssembly/ElsaStudioWebAssembly.csproj b/src/bundles/ElsaStudioWebAssembly/ElsaStudioWebAssembly.csproj
index eba2a2fd1..02c5db25a 100644
--- a/src/bundles/ElsaStudioWebAssembly/ElsaStudioWebAssembly.csproj
+++ b/src/bundles/ElsaStudioWebAssembly/ElsaStudioWebAssembly.csproj
@@ -1,7 +1,7 @@
- net7.0;net8.0
+ net8.0
diff --git a/src/modules/Elsa.Common/Elsa.Common.csproj b/src/modules/Elsa.Common/Elsa.Common.csproj
index aeee7011b..869fd520a 100644
--- a/src/modules/Elsa.Common/Elsa.Common.csproj
+++ b/src/modules/Elsa.Common/Elsa.Common.csproj
@@ -18,8 +18,4 @@
-
-
-
-
diff --git a/src/modules/Elsa.Dapper/Elsa.Dapper.csproj b/src/modules/Elsa.Dapper/Elsa.Dapper.csproj
index dc9a4279f..5d4affe7a 100644
--- a/src/modules/Elsa.Dapper/Elsa.Dapper.csproj
+++ b/src/modules/Elsa.Dapper/Elsa.Dapper.csproj
@@ -14,9 +14,6 @@
-
-
-
diff --git a/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs b/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs
index 04085dbd8..a10e6ca19 100644
--- a/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs
+++ b/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs
@@ -1,3 +1,4 @@
+using System.Net;
using System.Net.Http.Headers;
using Elsa.Extensions;
using Elsa.Http.ContentWriters;
@@ -7,6 +8,7 @@ using Elsa.Workflows.Attributes;
using Elsa.Workflows.UIHints;
using Elsa.Workflows.Models;
using Microsoft.Extensions.Logging;
+using Polly;
using HttpHeaders = Elsa.Http.Models.HttpHeaders;
namespace Elsa.Http;
@@ -25,8 +27,7 @@ public abstract class SendHttpRequestBase : Activity
///
/// The URL to send the request to.
///
- [Input]
- public Input Url { get; set; } = default!;
+ [Input] public Input Url { get; set; } = default!;
///
/// The HTTP method to use when sending the request.
@@ -81,6 +82,11 @@ public abstract class SendHttpRequestBase : Activity
)]
public Input RequestHeaders { get; set; } = new(new HttpHeaders());
+ ///
+ /// Indicates whether resiliency mechanisms should be enabled for the HTTP request.
+ ///
+ public Input EnableResiliency { get; set; } = default!;
+
///
/// The HTTP response status code
///
@@ -122,15 +128,15 @@ public abstract class SendHttpRequestBase : Activity
private async Task TrySendAsync(ActivityExecutionContext context)
{
- var request = PrepareRequest(context);
var logger = (ILogger)context.GetRequiredService(typeof(ILogger<>).MakeGenericType(GetType()));
var httpClientFactory = context.GetRequiredService();
var httpClient = httpClientFactory.CreateClient(nameof(SendHttpRequestBase));
var cancellationToken = context.CancellationToken;
+ var resiliencyEnabled = EnableResiliency.GetOrDefault(context, () => false);
try
{
- var response = await httpClient.SendAsync(request, cancellationToken);
+ var response = await SendRequestAsync();
var parsedContent = await ParseContentAsync(context, response);
var statusCode = (int)response.StatusCode;
var responseHeaders = new HttpHeaders(response.Headers);
@@ -147,7 +153,7 @@ public abstract class SendHttpRequestBase : Activity
logger.LogWarning(e, "An error occurred while sending an HTTP request");
context.AddExecutionLogEntry("Error", e.Message, payload: new
{
- StackTrace = e.StackTrace
+ e.StackTrace
});
context.JournalData.Add("Error", e.Message);
await HandleRequestExceptionAsync(context, e);
@@ -157,11 +163,30 @@ public abstract class SendHttpRequestBase : Activity
logger.LogWarning(e, "An error occurred while sending an HTTP request");
context.AddExecutionLogEntry("Error", e.Message, payload: new
{
- StackTrace = e.StackTrace
+ e.StackTrace
});
context.JournalData.Add("Cancelled", true);
await HandleTaskCanceledExceptionAsync(context, e);
}
+
+ return;
+
+ async Task SendRequestAsync()
+ {
+ if (resiliencyEnabled)
+ {
+ var pipeline = BuildResiliencyPipeline(context);
+ return await pipeline.ExecuteAsync(async ct => await SendRequestAsyncCore(ct), cancellationToken);
+ }
+
+ return await SendRequestAsyncCore();
+ }
+
+ async Task SendRequestAsyncCore(CancellationToken ct = default)
+ {
+ var request = PrepareRequest(context);
+ return await httpClient.SendAsync(request, ct);
+ }
}
private async Task
diff --git a/src/modules/Elsa.Quartz.EntityFrameworkCore.PostgreSql/Elsa.Quartz.EntityFrameworkCore.PostgreSql.csproj b/src/modules/Elsa.Quartz.EntityFrameworkCore.PostgreSql/Elsa.Quartz.EntityFrameworkCore.PostgreSql.csproj
index 9b887cfcd..cfc79647c 100644
--- a/src/modules/Elsa.Quartz.EntityFrameworkCore.PostgreSql/Elsa.Quartz.EntityFrameworkCore.PostgreSql.csproj
+++ b/src/modules/Elsa.Quartz.EntityFrameworkCore.PostgreSql/Elsa.Quartz.EntityFrameworkCore.PostgreSql.csproj
@@ -15,9 +15,6 @@
-
-
-
diff --git a/src/modules/Elsa.Quartz/Elsa.Quartz.csproj b/src/modules/Elsa.Quartz/Elsa.Quartz.csproj
index 4498802c4..9776c86fc 100644
--- a/src/modules/Elsa.Quartz/Elsa.Quartz.csproj
+++ b/src/modules/Elsa.Quartz/Elsa.Quartz.csproj
@@ -1,7 +1,7 @@
- net6.0;net7.0;net8.0
+ net8.0
Provides integration with the Quartz.NET library and provide am implementation of Elsa's IJobScheduler using Quartz.NET.