From 60508d40b53d7cbdadca815393473d2b363cea20 Mon Sep 17 00:00:00 2001 From: jdevillard Date: Sat, 7 Oct 2023 23:33:07 +0200 Subject: [PATCH] add applications properties to Message Sent to Service bus (#4492) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jérémie DEVILLARD --- .../Elsa.AzureServiceBus/Activities/SendMessage.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/modules/Elsa.AzureServiceBus/Activities/SendMessage.cs b/src/modules/Elsa.AzureServiceBus/Activities/SendMessage.cs index 8017690cf..c4fc2010e 100644 --- a/src/modules/Elsa.AzureServiceBus/Activities/SendMessage.cs +++ b/src/modules/Elsa.AzureServiceBus/Activities/SendMessage.cs @@ -52,6 +52,15 @@ public class SendMessage : CodeActivity /// The formatter to use when serializing the message body. /// public Input FormatterType { get; set; } = default!; + /// + /// The application properties to embed with the Service Bus Message + /// + [Input(Category = "Advanced", + DefaultSyntax = "Json", + SupportedSyntaxes = new[] { "JavaScript", "Json" }, + UIHint = InputUIHints.MultiLine) + ] + public Input?> ApplicationProperties { get; set; } = default; /// protected override async ValueTask ExecuteAsync(ActivityExecutionContext context) @@ -69,6 +78,9 @@ public class SendMessage : CodeActivity // TODO: Maybe expose additional members? }; + if (context.Get(ApplicationProperties) != null) + foreach (var property in context.Get(ApplicationProperties)) + message.ApplicationProperties.Add(property.Key, ((System.Text.Json.JsonElement)property.Value).GetString()); var client = context.GetRequiredService();