diff --git a/src/modules/Elsa.Http/Extensions/ExpressionExecutionContextExtensions.cs b/src/modules/Elsa.Http/Extensions/ExpressionExecutionContextExtensions.cs
index c86313fe1..fc85796db 100644
--- a/src/modules/Elsa.Http/Extensions/ExpressionExecutionContextExtensions.cs
+++ b/src/modules/Elsa.Http/Extensions/ExpressionExecutionContextExtensions.cs
@@ -8,20 +8,43 @@ using Microsoft.Extensions.Options;
// ReSharper disable once CheckNamespace
namespace Elsa.Extensions;
-internal static class ExpressionExecutionContextExtensions
+///
+///
+///
+public static class ExpressionExecutionContextExtensions
{
+ ///
+ /// Generates a URL that can be used to trigger an event.
+ ///
+ /// The expression execution context.
+ /// The name of the event to trigger.
+ /// The lifetime of the event trigger token.
+ /// A URL that can be used to trigger an event.
public static string GenerateEventTriggerUrl(this ExpressionExecutionContext context, string eventName, TimeSpan lifetime)
{
var token = context.GenerateEventTriggerTokenInternal(eventName, lifetime);
return context.GenerateEventTriggerUrlInternal(token);
}
+ ///
+ /// Generates a URL that can be used to trigger an event.
+ ///
+ /// The expression execution context.
+ /// The name of the event to trigger.
+ /// The expiration date of the event trigger token.
+ /// A URL that can be used to trigger an event.
public static string GenerateEventTriggerUrl(this ExpressionExecutionContext context, string eventName, DateTimeOffset expiresAt)
{
var token = context.GenerateEventTriggerTokenInternal(eventName, expiresAt: expiresAt);
return context.GenerateEventTriggerUrlInternal(token);
}
+ ///
+ /// Generates a URL that can be used to trigger an event.
+ ///
+ /// The expression execution context.
+ /// The name of the event to trigger.
+ /// A URL that can be used to trigger an event.
public static string GenerateEventTriggerUrl(this ExpressionExecutionContext context, string eventName)
{
var token = context.GenerateEventTriggerTokenInternal(eventName);
diff --git a/src/modules/Elsa.Http/Options/HttpActivityOptions.cs b/src/modules/Elsa.Http/Options/HttpActivityOptions.cs
index 4a5ee4ae1..76458bcec 100644
--- a/src/modules/Elsa.Http/Options/HttpActivityOptions.cs
+++ b/src/modules/Elsa.Http/Options/HttpActivityOptions.cs
@@ -10,7 +10,7 @@ public class HttpActivityOptions
///
/// The root path at which HTTP activities can be invoked.
///
- public PathString? BasePath { get; set; }
+ public PathString? BasePath { get; set; } = "/workflows";
///
/// The base URL of the server. This should be set to the same value at which the Elsa Server is publicly available. It will be used when generating absolute URLs need to be generated by activities such as SendEmail.
diff --git a/src/samples/aspnet/Elsa.Samples.AspNet.DocumentApproval/DocumentApprovalWorkflow.cs b/src/samples/aspnet/Elsa.Samples.AspNet.DocumentApproval/DocumentApprovalWorkflow.cs
index 2d4abf7f6..dff9e387d 100644
--- a/src/samples/aspnet/Elsa.Samples.AspNet.DocumentApproval/DocumentApprovalWorkflow.cs
+++ b/src/samples/aspnet/Elsa.Samples.AspNet.DocumentApproval/DocumentApprovalWorkflow.cs
@@ -2,6 +2,7 @@ using System.Dynamic;
using System.Net;
using System.Net.Mime;
using Elsa.Expressions.Models;
+using Elsa.Extensions;
using Elsa.Http;
using Elsa.Http.Models;
using Elsa.Workflows.Core;
@@ -18,7 +19,7 @@ namespace Elsa.Samples.AspNet.DocumentApproval
{
protected override void Build(IWorkflowBuilder builder)
{
- var documentVariable = builder.WithVariable();
+ var documentVariable = builder.WithVariable().WithWorkflowStorage();
var approvedVariable = builder.WithVariable();
builder.Root = new Sequence
@@ -144,7 +145,7 @@ namespace Elsa.Samples.AspNet.DocumentApproval
private string GenerateSignalUrl(ExpressionExecutionContext context, string signalName)
{
- return "Signal (events in Elsa 3) URL generation not yet implemented";
+ return context.GenerateEventTriggerUrl(signalName);
}
}
}
\ No newline at end of file
diff --git a/src/samples/aspnet/Elsa.Samples.AspNet.DocumentApproval/Program.cs b/src/samples/aspnet/Elsa.Samples.AspNet.DocumentApproval/Program.cs
index 19ba12f21..480c78157 100644
--- a/src/samples/aspnet/Elsa.Samples.AspNet.DocumentApproval/Program.cs
+++ b/src/samples/aspnet/Elsa.Samples.AspNet.DocumentApproval/Program.cs
@@ -7,8 +7,17 @@ var services = builder.Services;
services.AddElsa(elsa => elsa
.AddWorkflowsFrom()
+ // Add FastEndpoints.
+ .UseWorkflowsApi()
+
+ // Enable SAS tokens.
+ .UseSasTokens()
+
// Enable Elsa HTTP module (for HTTP related activities).
- .UseHttp()
+ .UseHttp(http => http.ConfigureHttpOptions = options =>
+ {
+ options.BaseUrl = new Uri("https://localhost:5001");
+ })
);
// Configure middleware pipeline.
@@ -17,6 +26,9 @@ var app = builder.Build();
if (app.Environment.IsDevelopment())
app.UseDeveloperExceptionPage();
+// Expose Elsa APIs.
+app.UseWorkflowsApi();
+
// Add Elsa HTTP middleware (to handle requests mapped to HTTP Endpoint activities)
app.UseWorkflows();