diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/appsettings.Development.json b/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/appsettings.Development.json index a3bb2eec7..4ffceca51 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/appsettings.Development.json +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/appsettings.Development.json @@ -180,7 +180,8 @@ "Override": { "System": "Warning", "Microsoft": "Warning", - "DotNetCore": "Warning" + "DotNetCore": "Warning", + "LINGYUN.Abp.ElsaNext.Notifications": "Debug" } }, "WriteTo": [ diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Notifications/LINGYUN/Abp/ElsaNext/Notifications/AbpElsaNextNotificationsModule.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Notifications/LINGYUN/Abp/ElsaNext/Notifications/AbpElsaNextNotificationsModule.cs index afa8b0da0..1ca4fa170 100644 --- a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Notifications/LINGYUN/Abp/ElsaNext/Notifications/AbpElsaNextNotificationsModule.cs +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Notifications/LINGYUN/Abp/ElsaNext/Notifications/AbpElsaNextNotificationsModule.cs @@ -2,6 +2,7 @@ using LINGYUN.Abp.ElsaNext.Localization; using LINGYUN.Abp.ElsaNext.Notifications.Extensions; using LINGYUN.Abp.Notifications; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.VirtualFileSystem; @@ -34,5 +35,7 @@ public class AbpElsaNextNotificationsModule : AbpModule .Get() .AddVirtualJson("/LINGYUN/Abp/ElsaNext/Notifications/Localization/Resources"); }); + + context.Services.AddNotificationHandlersFrom(); } } diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Notifications/LINGYUN/Abp/ElsaNext/Notifications/Handlers/ActivityNotificationHandler.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Notifications/LINGYUN/Abp/ElsaNext/Notifications/Handlers/ActivityNotificationHandler.cs new file mode 100644 index 000000000..e39215967 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Notifications/LINGYUN/Abp/ElsaNext/Notifications/Handlers/ActivityNotificationHandler.cs @@ -0,0 +1,42 @@ +using Elsa.Mediator.Contracts; +using Elsa.Workflows.Notifications; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.ElsaNext.Notifications.Handlers; + +public class ActivityNotificationHandler : + INotificationHandler, + INotificationHandler, + INotificationHandler, + INotificationHandler +{ + public ILogger Logger { protected get; set; } + public ActivityNotificationHandler() + { + Logger = NullLogger.Instance; + } + + public async virtual Task HandleAsync(ActivityExecuting notification, CancellationToken cancellationToken) + { + Logger.LogDebug("The activity notification: {notification} has been triggered.", notification.ToString()); + } + + public async virtual Task HandleAsync(ActivityExecuted notification, CancellationToken cancellationToken) + { + Logger.LogDebug("The activity notification: {notification} has been triggered.", notification.ToString()); + } + + public async virtual Task HandleAsync(ActivityCancelled notification, CancellationToken cancellationToken) + { + Logger.LogDebug("The activity notification: {notification} has been triggered.", notification.ToString()); + } + + public async virtual Task HandleAsync(ActivityCompleted notification, CancellationToken cancellationToken) + { + Logger.LogDebug("The activity notification: {notification} has been triggered.", notification.ToString()); + } +} diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Notifications/LINGYUN/Abp/ElsaNext/Notifications/Handlers/WorkflowNotificationHandler.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Notifications/LINGYUN/Abp/ElsaNext/Notifications/Handlers/WorkflowNotificationHandler.cs new file mode 100644 index 000000000..3feaa03f5 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Notifications/LINGYUN/Abp/ElsaNext/Notifications/Handlers/WorkflowNotificationHandler.cs @@ -0,0 +1,53 @@ +using Elsa.Mediator.Contracts; +using Elsa.Workflows.Notifications; +using Elsa.Workflows.Runtime.Notifications; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using System.Threading; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.ElsaNext.Notifications.Handlers; + +public class WorkflowNotificationHandler : + INotificationHandler, + INotificationHandler, + INotificationHandler, + INotificationHandler, + INotificationHandler, + INotificationHandler +{ + public ILogger Logger { protected get; set; } + public WorkflowNotificationHandler() + { + Logger = NullLogger.Instance; + } + public async virtual Task HandleAsync(WorkflowExecuting notification, CancellationToken cancellationToken) + { + Logger.LogDebug("The workflow notification: {notification} has been triggered.", notification.ToString()); + } + + public async virtual Task HandleAsync(WorkflowStarted notification, CancellationToken cancellationToken) + { + Logger.LogDebug("The workflow notification: {notification} has been triggered.", notification.ToString()); + } + + public async virtual Task HandleAsync(WorkflowFinished notification, CancellationToken cancellationToken) + { + Logger.LogDebug("The workflow notification: {notification} has been triggered.", notification.ToString()); + } + + public async virtual Task HandleAsync(WorkflowExecuted notification, CancellationToken cancellationToken) + { + Logger.LogDebug("The workflow notification: {notification} has been triggered.", notification.ToString()); + } + + public async virtual Task HandleAsync(WorkflowCancelling notification, CancellationToken cancellationToken) + { + Logger.LogDebug("The workflow notification: {notification} has been triggered.", notification.ToString()); + } + + public async virtual Task HandleAsync(WorkflowCancelled notification, CancellationToken cancellationToken) + { + Logger.LogDebug("The workflow notification: {notification} has been triggered.", notification.ToString()); + } +}