diff --git a/src/modules/Elsa.Workflows.Runtime/Activities/PublishEvent.cs b/src/modules/Elsa.Workflows.Runtime/Activities/PublishEvent.cs
index f63488035..f77868e04 100644
--- a/src/modules/Elsa.Workflows.Runtime/Activities/PublishEvent.cs
+++ b/src/modules/Elsa.Workflows.Runtime/Activities/PublishEvent.cs
@@ -1,10 +1,10 @@
-using System.Runtime.CompilerServices;
-using System.Text.Json.Serialization;
using Elsa.Extensions;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Runtime.Contracts;
using JetBrains.Annotations;
+using System.Runtime.CompilerServices;
+using System.Text.Json.Serialization;
namespace Elsa.Workflows.Runtime.Activities;
@@ -20,7 +20,7 @@ public class PublishEvent : Activity
public PublishEvent()
{
}
-
+
///
public PublishEvent([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
{
@@ -31,20 +31,28 @@ public class PublishEvent : Activity
///
[Input(Description = "The name of the event to publish.")]
public Input EventName { get; set; } = default!;
-
+
///
/// The correlation ID to scope the event to.
///
[Input(Description = "The correlation ID to scope the event to.")]
public Input CorrelationId { get; set; } = default!;
+ ///
+ /// The input to send as the event body.
+ ///
+ [Input(Description = "The input to send as the event body.")]
+ public Input?> Input { get; set; } = default!;
+
///
protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
{
var eventName = EventName.Get(context);
var correlationId = CorrelationId.GetOrDefault(context);
+ var input = Input.GetOrDefault(context);
var publisher = context.GetRequiredService();
- await publisher.DispatchAsync(eventName, correlationId, cancellationToken: context.CancellationToken);
+ await publisher.DispatchAsync(eventName, correlationId, input: input, cancellationToken: context.CancellationToken);
+ await context.CompleteActivityAsync();
}
}
\ No newline at end of file