Remove unused activities, messages, and dependencies
Deleted unused custom activity classes, message types, and related registrations from the codebase. Also cleaned up surplus library references and configurations from Program.cs to streamline and simplify the project.
This commit is contained in:
parent
3c15268911
commit
25e36c3467
|
|
@ -1,19 +0,0 @@
|
|||
using Elsa.Extensions;
|
||||
using Elsa.Workflows;
|
||||
|
||||
namespace Elsa.Server.Web.Activities;
|
||||
|
||||
public class CustomDelay : Activity
|
||||
{
|
||||
protected override ValueTask ExecuteAsync(ActivityExecutionContext context)
|
||||
{
|
||||
context.DelayFor(TimeSpan.FromSeconds(5), OnDelayElapsedAsync);
|
||||
return default;
|
||||
}
|
||||
|
||||
private async ValueTask OnDelayElapsedAsync(ActivityExecutionContext context)
|
||||
{
|
||||
Console.WriteLine("Delay elapsed");
|
||||
await context.CompleteActivityAsync();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
using Elsa.Expressions.Models;
|
||||
using Elsa.Workflows;
|
||||
using Elsa.Workflows.Runtime.Activities;
|
||||
|
||||
namespace Elsa.Server.Web.Activities;
|
||||
|
||||
public class CustomEvent : EventBase<object>
|
||||
{
|
||||
protected override string GetEventName(ExpressionExecutionContext context)
|
||||
{
|
||||
return "MyEvent";
|
||||
}
|
||||
|
||||
protected override void OnEventReceived(ActivityExecutionContext context, object? eventData)
|
||||
{
|
||||
Console.WriteLine("Event received with data: " + eventData);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
using Elsa.Http;
|
||||
using Elsa.Http.Extensions;
|
||||
using Elsa.Workflows;
|
||||
|
||||
namespace Elsa.Server.Web.Activities;
|
||||
|
||||
public class CustomHttpEndpoint : HttpEndpointBase
|
||||
{
|
||||
protected override HttpEndpointOptions GetOptions()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
Path = "my-path",
|
||||
Methods = [HttpMethods.Get],
|
||||
};
|
||||
}
|
||||
|
||||
protected override async ValueTask OnHttpRequestReceivedAsync(ActivityExecutionContext context, HttpContext httpContext)
|
||||
{
|
||||
httpContext.Response.StatusCode = 200;
|
||||
await httpContext.Response.WriteAsync("Hello World", context.CancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
using Elsa.Expressions.Models;
|
||||
using Elsa.Scheduling.Activities;
|
||||
using Elsa.Workflows;
|
||||
|
||||
namespace Elsa.Server.Web.Activities;
|
||||
|
||||
public class CustomTimer : TimerBase
|
||||
{
|
||||
protected override TimeSpan GetInterval(ExpressionExecutionContext context)
|
||||
{
|
||||
return TimeSpan.FromSeconds(5);
|
||||
}
|
||||
|
||||
protected override void OnTimerElapsed(ActivityExecutionContext context)
|
||||
{
|
||||
Console.WriteLine("Timer elapsed");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
namespace Elsa.Server.Web.Messages;
|
||||
|
||||
public class OrderReceived
|
||||
{
|
||||
public string OrderId { get; set; } = null!;
|
||||
}
|
||||
|
|
@ -5,11 +5,9 @@ using Elsa.Caching.Options;
|
|||
using Elsa.Common.Codecs;
|
||||
using Elsa.Common.DistributedHosting.DistributedLocks;
|
||||
using Elsa.Common.RecurringTasks;
|
||||
using Elsa.Common.Serialization;
|
||||
using Elsa.Dapper.Extensions;
|
||||
using Elsa.Dapper.Services;
|
||||
using Elsa.DropIns.Extensions;
|
||||
using Elsa.EntityFrameworkCore;
|
||||
using Elsa.EntityFrameworkCore.Extensions;
|
||||
using Elsa.EntityFrameworkCore.Modules.Alterations;
|
||||
using Elsa.EntityFrameworkCore.Modules.Identity;
|
||||
|
|
@ -21,7 +19,6 @@ using Elsa.Extensions;
|
|||
using Elsa.Features.Services;
|
||||
using Elsa.Identity.Multitenancy;
|
||||
using Elsa.Kafka;
|
||||
using Elsa.Kafka.Factories;
|
||||
using Elsa.MassTransit.Extensions;
|
||||
using Elsa.MongoDb.Extensions;
|
||||
using Elsa.MongoDb.Modules.Alterations;
|
||||
|
|
@ -30,7 +27,6 @@ using Elsa.MongoDb.Modules.Management;
|
|||
using Elsa.MongoDb.Modules.Runtime;
|
||||
using Elsa.MongoDb.Modules.Tenants;
|
||||
using Elsa.OpenTelemetry.Middleware;
|
||||
using Elsa.Resilience.Extensions;
|
||||
using Elsa.Retention.Extensions;
|
||||
using Elsa.Retention.Models;
|
||||
using Elsa.Secrets.Extensions;
|
||||
|
|
@ -39,7 +35,6 @@ using Elsa.Secrets.Persistence;
|
|||
using Elsa.Server.Web;
|
||||
using Elsa.Server.Web.Extensions;
|
||||
using Elsa.Server.Web.Filters;
|
||||
using Elsa.Server.Web.Messages;
|
||||
using Elsa.Tenants.AspNetCore;
|
||||
using Elsa.Tenants.Extensions;
|
||||
using Elsa.Workflows;
|
||||
|
|
@ -47,9 +42,7 @@ using Elsa.Workflows.Api;
|
|||
using Elsa.Workflows.CommitStates.Strategies;
|
||||
using Elsa.Workflows.IncidentStrategies;
|
||||
using Elsa.Workflows.LogPersistence;
|
||||
using Elsa.Workflows.Management;
|
||||
using Elsa.Workflows.Management.Stores;
|
||||
using Elsa.Workflows.Memory;
|
||||
using Elsa.Workflows.Options;
|
||||
using Elsa.Workflows.Runtime.Distributed.Extensions;
|
||||
using Elsa.Workflows.Runtime.Options;
|
||||
|
|
@ -65,11 +58,7 @@ using JetBrains.Annotations;
|
|||
using Medallion.Threading.FileSystem;
|
||||
using Medallion.Threading.Postgres;
|
||||
using Medallion.Threading.Redis;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.Extensions.Options;
|
||||
using OpenTelemetry;
|
||||
using OpenTelemetry.Exporter;
|
||||
using OpenTelemetry.Logs;
|
||||
using OpenTelemetry.Metrics;
|
||||
using OpenTelemetry.Resources;
|
||||
using OpenTelemetry.Trace;
|
||||
|
|
@ -126,10 +115,6 @@ var distributedLockProviderName = configuration.GetSection("Runtime:DistributedL
|
|||
var appRole = Enum.Parse<ApplicationRole>(configuration["AppRole"] ?? "Default");
|
||||
var sqlDatabaseProvider = Enum.Parse<SqlDatabaseProvider>(configuration["DatabaseProvider"] ?? "Sqlite");
|
||||
|
||||
// Optionally create type aliases for easier configuration.
|
||||
TypeAliasRegistry.RegisterAlias("OrderReceivedProducerFactory", typeof(GenericProducerFactory<string, OrderReceived>));
|
||||
TypeAliasRegistry.RegisterAlias("OrderReceivedConsumerFactory", typeof(GenericConsumerFactory<string, OrderReceived>));
|
||||
|
||||
if (useManualOtelInstrumentation)
|
||||
{
|
||||
services.AddOpenTelemetry()
|
||||
|
|
@ -329,7 +314,6 @@ services
|
|||
|
||||
management.SetDefaultLogPersistenceMode(LogPersistenceMode.Inherit);
|
||||
management.UseReadOnlyMode(useReadOnlyMode);
|
||||
management.AddVariableTypeAndAlias<OrderReceived>("Application");
|
||||
})
|
||||
.UseWorkflowRuntime(runtime =>
|
||||
{
|
||||
|
|
@ -445,7 +429,6 @@ services
|
|||
options.AllowClrAccess = true;
|
||||
options.DisableWrappers = disableVariableWrappers;
|
||||
options.DisableVariableCopying = disableVariableCopying;
|
||||
options.RegisterType<OrderReceived>();
|
||||
options.ConfigureEngine(engine =>
|
||||
{
|
||||
engine.Execute("function greet(name) { return `Hello ${name}!`; }");
|
||||
|
|
@ -546,7 +529,6 @@ services
|
|||
elsa.UseMassTransit(massTransit =>
|
||||
{
|
||||
massTransit.DisableConsumers = appRole == ApplicationRole.Api;
|
||||
massTransit.AddMessageType<OrderReceived>();
|
||||
|
||||
if (massTransitBroker == MassTransitBroker.AzureServiceBus)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
using Elsa.Workflows;
|
||||
using Elsa.Workflows.Activities;
|
||||
using Elsa.Extensions;
|
||||
using Elsa.Workflows.CommitStates.Strategies;
|
||||
|
||||
namespace Elsa.Server.Web;
|
||||
|
||||
public class SampleWorkflow : WorkflowBase
|
||||
{
|
||||
protected override void Build(IWorkflowBuilder builder)
|
||||
{
|
||||
builder.WorkflowOptions.CommitStrategyName = "Every 10 seconds";
|
||||
builder.Root = new Sequence
|
||||
{
|
||||
Activities =
|
||||
{
|
||||
new WriteLine("Commit before executing").SetCommitStrategy(nameof(ExecutingActivityStrategy)),
|
||||
new WriteLine("Commit after executing").SetCommitStrategy(nameof(ExecutedActivityStrategy)),
|
||||
new WriteLine("Commit before & after executing").SetCommitStrategy(nameof(CommitAlwaysActivityStrategy)),
|
||||
new WriteLine("Commit only based on the workflow commit options").SetCommitStrategy(null),
|
||||
new WriteLine("Never commit the workflow when this activity is about to execute or has executed").SetCommitStrategy(nameof(CommitNeverActivityStrategy)),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
using Elsa.Workflows;
|
||||
using Elsa.Workflows.Attributes;
|
||||
|
||||
namespace Elsa.Server.Web;
|
||||
|
||||
[Activity(Kind = ActivityKind.Task)]
|
||||
public class SlowActivity : CodeActivity
|
||||
{
|
||||
protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
|
||||
{
|
||||
Console.WriteLine("Starting...");
|
||||
await Task.Delay(TimeSpan.FromSeconds(45));
|
||||
Console.WriteLine("Done.");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue