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.9 KiB
1.9 KiB
LINGYUN.Abp.Webhooks.Core
Core webhook module that provides webhook definition, configuration and basic functionality support.
Features
- Webhook definition management
- Configurable webhook timeout and retry mechanism
- Automatic subscription deactivation protection
- Customizable HTTP headers
- Support for multiple webhook providers
Module Dependencies
[DependsOn(typeof(AbpWebhooksCoreModule))]
public class YouProjectModule : AbpModule
{
// other
}
Configuration
{
"Webhooks": {
"TimeoutDuration": "00:01:00", // Default timeout duration, 60 seconds by default
"MaxSendAttemptCount": 5, // Maximum number of send attempts
"IsAutomaticSubscriptionDeactivationEnabled": true, // Whether to automatically deactivate subscription when reaching maximum consecutive failures
"MaxConsecutiveFailCountBeforeDeactivateSubscription": 15, // Maximum consecutive failures before subscription deactivation, default is MaxSendAttemptCount * 3
"DefaultAgentIdentifier": "Abp-Webhooks", // Default sender identifier
"DefaultHttpHeaders": { // Default HTTP headers
"_AbpDontWrapResult": "true",
"X-Requested-From": "abp-webhooks"
}
}
}
Basic Usage
- Define a 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")
)
);
}
}
- Configure Webhook Options
Configure<AbpWebhooksOptions>(options =>
{
options.TimeoutDuration = TimeSpan.FromMinutes(2);
options.MaxSendAttemptCount = 3;
options.AddHeader("Custom-Header", "Value");
});