这是基于vue-vben-admin 模板适用于abp Vnext的前端管理项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1.7 KiB

LINGYUN.Abp.Webhooks.Core

Webhook核心模块,提供Webhook定义、配置和基础功能支持。

English

功能特性

  • Webhook定义管理
  • 可配置的Webhook超时和重试机制
  • 自动订阅失效保护
  • 可自定义HTTP请求头
  • 支持多Webhook提供者

模块引用

[DependsOn(typeof(AbpWebhooksCoreModule))]
public class YouProjectModule : AbpModule
{
  // other
}

配置项

{
  "Webhooks": {
    "TimeoutDuration": "00:01:00",  // 默认超时时间,默认60秒
    "MaxSendAttemptCount": 5,  // 默认最大发送次数
    "IsAutomaticSubscriptionDeactivationEnabled": true,  // 是否在达到最大连续失败次数时自动取消订阅
    "MaxConsecutiveFailCountBeforeDeactivateSubscription": 15,  // 取消订阅前最大连续失败次数,默认为MaxSendAttemptCount * 3
    "DefaultAgentIdentifier": "Abp-Webhooks",  // 默认发送方标识
    "DefaultHttpHeaders": {  // 默认请求头
      "_AbpDontWrapResult": "true",
      "X-Requested-From": "abp-webhooks"
    }
  }
}

基本用法

  1. 定义Webhook
public class YourWebhookDefinitionProvider : WebhookDefinitionProvider
{
    public override void Define(IWebhookDefinitionContext context)
    {
        context.Add(
            new WebhookDefinition(
                name: "TestWebhook",
                displayName: L("DisplayName:TestWebhook"),
                description: L("Description:TestWebhook")
            )
        );
    }
}
  1. 配置Webhook选项
Configure<AbpWebhooksOptions>(options =>
{
    options.TimeoutDuration = TimeSpan.FromMinutes(2);
    options.MaxSendAttemptCount = 3;
    options.AddHeader("Custom-Header", "Value");
});