Added sample code for demonstrating Azure Service Bus activities
This commit is contained in:
parent
844ada9a67
commit
a4d91c0ae0
|
|
@ -29,8 +29,6 @@ namespace Elsa.Activities.AzureServiceBus
|
|||
[ActivityOutput]
|
||||
public object? Output { get; set; }
|
||||
|
||||
|
||||
|
||||
protected override IActivityExecutionResult OnExecute(ActivityExecutionContext context) => context.WorkflowExecutionContext.IsFirstPass ? ExecuteInternal(context) : Suspend();
|
||||
protected override IActivityExecutionResult OnResume(ActivityExecutionContext context) => ExecuteInternal(context);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Elsa.Activities.AzureServiceBus
|
|||
{
|
||||
public override void ConfigureElsa(ElsaOptionsBuilder elsa, IConfiguration configuration)
|
||||
{
|
||||
var section = configuration.GetSection("Elsa:Azure:ServiceBus");
|
||||
var section = configuration.GetSection("Elsa:Features:Azure:ServiceBus");
|
||||
|
||||
elsa.AddAzureServiceBusActivities(options =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
namespace Elsa.Samples.Server.Host.Models
|
||||
{
|
||||
public class SomeMessage
|
||||
{
|
||||
public string Message { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Elsa.Samples.Server.Host.Models;
|
||||
using Elsa.Scripting.JavaScript.Extensions;
|
||||
using Elsa.Scripting.JavaScript.Messages;
|
||||
using MediatR;
|
||||
|
||||
namespace Elsa.Samples.Server.Host.Scripting.JavaScript
|
||||
{
|
||||
public class ConfigureJavaScriptEngine : INotificationHandler<EvaluatingJavaScriptExpression>
|
||||
{
|
||||
public Task Handle(EvaluatingJavaScriptExpression notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var engine = notification.Engine;
|
||||
|
||||
engine.RegisterType<SomeMessage>();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -88,6 +88,7 @@ namespace Elsa.Samples.Server.Host
|
|||
|
||||
// Elsa API endpoints.
|
||||
services
|
||||
.AddNotificationHandlersFrom<Startup>()
|
||||
.AddElsaApiEndpoints()
|
||||
.AddElsaSwagger();
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
"SqlServer": "Server=localhost;Database=Elsa;Integrated Security=true;MultipleActiveResultSets=True;Max Pool Size=500;Connection Timeout=3600",
|
||||
"Sqlite": "Data Source=elsa.sqlite.db;Cache=Shared;",
|
||||
"MongoDb": "mongodb://localhost:27017/Elsa",
|
||||
"PostgreSql": "Server=127.0.0.1;Port=5432;Database=elsa;User Id=postgres;Password=password;"
|
||||
"PostgreSql": "Server=127.0.0.1;Port=5432;Database=elsa;User Id=postgres;Password=password;",
|
||||
"AzureServiceBus": ""
|
||||
},
|
||||
"Elsa": {
|
||||
"Features": {
|
||||
|
|
@ -34,6 +35,12 @@
|
|||
"Conductor": true,
|
||||
"Telnyx": true,
|
||||
"File": true,
|
||||
"Azure": {
|
||||
"ServiceBus":{
|
||||
"Enabled": true,
|
||||
"ConnectionStringName": "AzureServiceBus"
|
||||
}
|
||||
},
|
||||
"Webhooks": {
|
||||
"Enabled": true,
|
||||
"Framework": "EntityFrameworkCore",
|
||||
|
|
|
|||
Loading…
Reference in a new issue