From d40be0ea67d3254ecdb64cedff1d5727592f5ffb Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 5 Jun 2024 16:00:39 +0800 Subject: [PATCH] feat(webhooks): user subscription rewrite timeout. --- ...meout-Duration-To-Subscription.Designer.cs | 264 ++++++++++++++++++ ...03_Add-Timeout-Duration-To-Subscription.cs | 28 ++ ...agementMigrationsDbContextModelSnapshot.cs | 5 +- .../Abp/Webhooks/AbpWebhooksOptions.cs | 6 +- .../Abp/Webhooks/DefaultWebhookPublisher.cs | 3 +- .../Abp/Webhooks/DefaultWebhookSender.cs | 20 +- .../LINGYUN/Abp/Webhooks/WebhookSenderArgs.cs | 4 + .../Abp/Webhooks/WebhookSubscriptionInfo.cs | 19 +- .../WebhookSubscriptionCreateOrUpdateInput.cs | 7 + .../WebhookSubscriptionDto.cs | 1 + .../WebhookSubscriptionAppService.cs | 2 + .../Localization/Resources/en.json | 2 + .../Localization/Resources/zh-Hans.json | 2 + .../WebhookSubscriptionConsts.cs | 2 + .../WebhooksManagement/WebhookSubscription.cs | 1 + 15 files changed, 343 insertions(+), 23 deletions(-) create mode 100644 aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/20240605074803_Add-Timeout-Duration-To-Subscription.Designer.cs create mode 100644 aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/20240605074803_Add-Timeout-Duration-To-Subscription.cs diff --git a/aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/20240605074803_Add-Timeout-Duration-To-Subscription.Designer.cs b/aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/20240605074803_Add-Timeout-Duration-To-Subscription.Designer.cs new file mode 100644 index 000000000..9df3d07a1 --- /dev/null +++ b/aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/20240605074803_Add-Timeout-Duration-To-Subscription.Designer.cs @@ -0,0 +1,264 @@ +// +using System; +using LY.MicroService.WebhooksManagement.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +#nullable disable + +namespace LY.MicroService.WebhooksManagement.EntityFrameworkCore.Migrations +{ + [DbContext(typeof(WebhooksManagementMigrationsDbContext))] + [Migration("20240605074803_Add-Timeout-Duration-To-Subscription")] + partial class AddTimeoutDurationToSubscription + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("RequiredFeatures") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("GroupName"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpWebhooksWebhooks", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookEventRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("Data") + .HasMaxLength(2147483647) + .HasColumnType("longtext") + .HasColumnName("Data"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WebhookName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("WebhookName"); + + b.HasKey("Id"); + + b.ToTable("AbpWebhooksEvents", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookGroupDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpWebhooksWebhookGroups", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookSendRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("RequestHeaders") + .HasMaxLength(2147483647) + .HasColumnType("longtext") + .HasColumnName("RequestHeaders"); + + b.Property("Response") + .HasMaxLength(2147483647) + .HasColumnType("longtext") + .HasColumnName("Response"); + + b.Property("ResponseHeaders") + .HasMaxLength(2147483647) + .HasColumnType("longtext") + .HasColumnName("ResponseHeaders"); + + b.Property("ResponseStatusCode") + .HasColumnType("int"); + + b.Property("SendExactSameData") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WebhookEventId") + .HasColumnType("char(36)"); + + b.Property("WebhookSubscriptionId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("WebhookEventId"); + + b.ToTable("AbpWebhooksSendAttempts", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookSubscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("Description") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("Description"); + + b.Property("Headers") + .HasMaxLength(2147483647) + .HasColumnType("longtext") + .HasColumnName("Headers"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Secret") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("Secret"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TimeoutDuration") + .HasColumnType("int"); + + b.Property("WebhookUri") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("WebhookUri"); + + b.Property("Webhooks") + .HasMaxLength(2147483647) + .HasColumnType("longtext") + .HasColumnName("Webhooks"); + + b.HasKey("Id"); + + b.ToTable("AbpWebhooksSubscriptions", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookSendRecord", b => + { + b.HasOne("LINGYUN.Abp.WebhooksManagement.WebhookEventRecord", "WebhookEvent") + .WithOne() + .HasForeignKey("LINGYUN.Abp.WebhooksManagement.WebhookSendRecord", "WebhookEventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WebhookEvent"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/20240605074803_Add-Timeout-Duration-To-Subscription.cs b/aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/20240605074803_Add-Timeout-Duration-To-Subscription.cs new file mode 100644 index 000000000..5cd98fcb8 --- /dev/null +++ b/aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/20240605074803_Add-Timeout-Duration-To-Subscription.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace LY.MicroService.WebhooksManagement.EntityFrameworkCore.Migrations +{ + /// + public partial class AddTimeoutDurationToSubscription : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TimeoutDuration", + table: "AbpWebhooksSubscriptions", + type: "int", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "TimeoutDuration", + table: "AbpWebhooksSubscriptions"); + } + } +} diff --git a/aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/WebhooksManagementMigrationsDbContextModelSnapshot.cs b/aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/WebhooksManagementMigrationsDbContextModelSnapshot.cs index 0e062afb0..717213fff 100644 --- a/aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/WebhooksManagementMigrationsDbContextModelSnapshot.cs +++ b/aspnet-core/migrations/LY.MicroService.WebhooksManagement.EntityFrameworkCore/Migrations/WebhooksManagementMigrationsDbContextModelSnapshot.cs @@ -18,7 +18,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) - .HasAnnotation("ProductVersion", "7.0.2") + .HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookDefinitionRecord", b => @@ -226,6 +226,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("TenantId") .HasColumnType("char(36)"); + b.Property("TimeoutDuration") + .HasColumnType("int"); + b.Property("WebhookUri") .IsRequired() .HasMaxLength(255) diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/AbpWebhooksOptions.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/AbpWebhooksOptions.cs index 6138d1ffd..421e24331 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/AbpWebhooksOptions.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks.Core/LINGYUN/Abp/Webhooks/AbpWebhooksOptions.cs @@ -58,13 +58,13 @@ public AbpWebhooksOptions() { "X-Requested-From", "abp-webhooks" }, }; - DefaultAgentIdentifier = "Abp Webhooks"; + DefaultAgentIdentifier = "Abp-Webhooks"; var assembly = typeof(AbpWebhooksOptions).Assembly; - var versionAttr = assembly.GetCustomAttribute(); + var versionAttr = assembly.GetCustomAttribute(); if (versionAttr != null) { - DefaultAgentIdentifier += " " + versionAttr.InformationalVersion; + DefaultAgentIdentifier += "/" + versionAttr.Version; } } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/DefaultWebhookPublisher.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/DefaultWebhookPublisher.cs index 8ea598c58..bf44162ae 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/DefaultWebhookPublisher.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/DefaultWebhookPublisher.cs @@ -111,7 +111,8 @@ await _backgroundJobManager.EnqueueAsync(new WebhookSenderArgs Headers = headersToSend, Secret = webhookSubscription.Secret, WebhookUri = webhookSubscription.WebhookUri, - SendExactSameData = sendExactSameData + SendExactSameData = sendExactSameData, + TimeoutDuration = webhookSubscription.TimeoutDuration, }); } } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/DefaultWebhookSender.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/DefaultWebhookSender.cs index 766a3b683..23e3a26cf 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/DefaultWebhookSender.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/DefaultWebhookSender.cs @@ -64,7 +64,9 @@ public async Task SendWebhookAsync(WebhookSenderArgs webhookSenderArgs) try { - var response = await SendHttpRequest(request); + var client = CreateWebhookClient(webhookSenderArgs); + + var response = await SendHttpRequest(client, request); isSucceed = response.IsSuccessStatusCode; statusCode = response.StatusCode; @@ -112,6 +114,18 @@ protected virtual HttpRequestMessage CreateWebhookRequestMessage(WebhookSenderAr return new HttpRequestMessage(HttpMethod.Post, webhookSenderArgs.WebhookUri); } + protected virtual HttpClient CreateWebhookClient(WebhookSenderArgs webhookSenderArgs) + { + var client = _httpClientFactory.CreateClient(AbpWebhooksModule.WebhooksClient); + if (webhookSenderArgs.TimeoutDuration.HasValue && + (webhookSenderArgs.TimeoutDuration >= 10 && webhookSenderArgs.TimeoutDuration <= 300)) + { + client.Timeout = TimeSpan.FromSeconds(webhookSenderArgs.TimeoutDuration.Value); + } + + return client; + } + protected virtual void AddAdditionalHeaders(HttpRequestMessage request, WebhookSenderArgs webhookSenderArgs) { foreach (var header in _options.DefaultHttpHeaders) @@ -169,10 +183,8 @@ protected virtual void AddAdditionalHeaders(HttpRequestMessage request, WebhookS } } - protected async virtual Task SendHttpRequest(HttpRequestMessage request) + protected async virtual Task SendHttpRequest(HttpClient client, HttpRequestMessage request) { - var client = _httpClientFactory.CreateClient(AbpWebhooksModule.WebhooksClient); - return await client.SendAsync(request); } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/WebhookSenderArgs.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/WebhookSenderArgs.cs index 7910ba0b1..76fa20429 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/WebhookSenderArgs.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/WebhookSenderArgs.cs @@ -58,6 +58,10 @@ public class WebhookSenderArgs /// /// public bool SendExactSameData { get; set; } + /// + /// Request timeout time, in seconds + /// + public int? TimeoutDuration { get; set; } public WebhookSenderArgs() { diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/WebhookSubscriptionInfo.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/WebhookSubscriptionInfo.cs index 9e4e3bf2a..cc9feb623 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/WebhookSubscriptionInfo.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/WebhookSubscriptionInfo.cs @@ -28,28 +28,19 @@ public class WebhookSubscriptionInfo /// /// Subscribed webhook definitions unique names.It contains webhook definitions list as json - /// - /// Do not change it manually. - /// Use , - /// , - /// and - /// to change it. - /// /// public List Webhooks { get; set; } /// /// Gets a set of additional HTTP headers.That headers will be sent with the webhook. It contains webhook header dictionary as json - /// - /// Do not change it manually. - /// Use , - /// , - /// , - /// to change it. - /// /// public IDictionary Headers { get; set; } + /// + /// Request timeout time, in seconds + /// + public int? TimeoutDuration { get; set; } + public WebhookSubscriptionInfo() { IsActive = true; diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionCreateOrUpdateInput.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionCreateOrUpdateInput.cs index 81650984d..4ef11f825 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionCreateOrUpdateInput.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionCreateOrUpdateInput.cs @@ -29,6 +29,13 @@ public abstract class WebhookSubscriptionCreateOrUpdateInput [DynamicStringLength(typeof(WebhookSubscriptionConsts), nameof(WebhookSubscriptionConsts.MaxDescriptionLength))] public string Description { get; set; } + [DynamicRange( + typeof(WebhookSubscriptionConsts), + typeof(int), + nameof(WebhookSubscriptionConsts.TimeoutDurationMinimum), + nameof(WebhookSubscriptionConsts.TimeoutDurationMaximum))] + public int? TimeoutDuration { get; set; } + public bool IsActive { get; set; } public Guid? TenantId { get; set; } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionDto.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionDto.cs index 45151e59e..3cdfad6c8 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionDto.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionDto.cs @@ -15,4 +15,5 @@ public class WebhookSubscriptionDto : CreationAuditedEntityDto, IHasConcur public List Webhooks { get; set; } = new List(); public IDictionary Headers { get; set; } = new Dictionary(); public string ConcurrencyStamp { get; set; } + public int? TimeoutDuration { get; set; } } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs index f9e1786df..9c9f15c9f 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs @@ -42,6 +42,7 @@ public async virtual Task CreateAsync(WebhookSubscriptio { IsActive = input.IsActive, Description = input.Description, + TimeoutDuration = input.TimeoutDuration, }; subscription = await SubscriptionRepository.InsertAsync(subscription); @@ -176,6 +177,7 @@ protected virtual void UpdateByInput(WebhookSubscription subscription, WebhookSu subscription.SetTenantId(input.TenantId); } subscription.IsActive = input.IsActive; + subscription.TimeoutDuration = input.TimeoutDuration; } private class WebhookSubscriptionGetListSpecification : Volo.Abp.Specifications.Specification diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json index bd228acc0..d86bb80fa 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json @@ -64,6 +64,8 @@ "DisplayName:IsStatic": "Static", "DisplayName:IsEnabled": "Enabled", "DisplayName:RequiredFeatures": "Required Features", + "DisplayName:TimeoutDuration": "Timeout Duration(s)", + "Description:TimeoutDuration": "After setting this value, the request will be initiated using the set timeout time, Effective range 10-300s.", "ResponseState:Successed": "Successed", "ResponseState:Failed": "Failed", "GroupDefinitions": "Group Definitions", diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json index 94f2be7c3..98ec0a219 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json @@ -64,6 +64,8 @@ "DisplayName:IsStatic": "静态", "DisplayName:IsEnabled": "启用", "DisplayName:RequiredFeatures": "必要的功能", + "DisplayName:TimeoutDuration": "超时时间(s)", + "Description:TimeoutDuration": "设置此值后,将用设置的超时时间来发起请求,有效范围10-300s.", "ResponseState:Successed": "成功", "ResponseState:Failed": "失败", "GroupDefinitions": "分组定义", diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionConsts.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionConsts.cs index e74d468b4..c45d3d2b8 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionConsts.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionConsts.cs @@ -7,4 +7,6 @@ public static class WebhookSubscriptionConsts public static int MaxWebhooksLength { get; set; } = int.MaxValue; public static int MaxHeadersLength { get; set; } = int.MaxValue; public static int MaxDescriptionLength { get; set; } = 128; + public static int TimeoutDurationMaximum { get; set; } = 300; + public static int TimeoutDurationMinimum { get; set; } = 10; } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhookSubscription.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhookSubscription.cs index 8969c517e..c917f20f6 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhookSubscription.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhookSubscription.cs @@ -17,6 +17,7 @@ public class WebhookSubscription : CreationAuditedEntity, IHasConcurrencyS public virtual string Headers { get; protected set; } public virtual string Description { get; set; } public virtual string ConcurrencyStamp { get; set; } + public virtual int? TimeoutDuration { get; set; } protected WebhookSubscription() {