From 37a205fac4cb5f40b8d3e471c8e2403a5b883c47 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 21 Apr 2025 11:24:12 +0800 Subject: [PATCH] Add AbpHangfireOptions configuration section to Hangfire documentation --- .../infrastructure/background-jobs/hangfire.md | 18 ++++++++++++++++++ .../background-workers/hangfire.md | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/docs/en/framework/infrastructure/background-jobs/hangfire.md b/docs/en/framework/infrastructure/background-jobs/hangfire.md index 396c7498b5..293f03494c 100644 --- a/docs/en/framework/infrastructure/background-jobs/hangfire.md +++ b/docs/en/framework/infrastructure/background-jobs/hangfire.md @@ -84,6 +84,24 @@ After you have installed these NuGet packages, you need to configure your projec } ```` +### AbpHangfireOptions + +You can configure the [BackgroundJobServerOptions](https://api.hangfire.io/html/T_Hangfire_BackgroundJobServerOptions.htm) of `AbpHangfireOptions` to customize the server. + +````csharp +Configure(options => +{ + // If no ServerOptions is set, ABP will use the default BackgroundJobServerOptions instance. + options.ServerOptions = new BackgroundJobServerOptions + { + Queues = ["default", "alpha"], + //... other properties + }; +}); +```` + +> You don't need to call `AddHangfireServer` method, ABP will use AbpHangfireOptions's `ServerOptions` to create a server. + ### Specifying Queue You can use the [`QueueAttribute`](https://docs.hangfire.io/en/latest/background-processing/configuring-queues.html) to specify the queue: diff --git a/docs/en/framework/infrastructure/background-workers/hangfire.md b/docs/en/framework/infrastructure/background-workers/hangfire.md index 3ccbaf35bd..4612e15b06 100644 --- a/docs/en/framework/infrastructure/background-workers/hangfire.md +++ b/docs/en/framework/infrastructure/background-workers/hangfire.md @@ -84,6 +84,24 @@ After you have installed these NuGet packages, you need to configure your projec } ```` +### AbpHangfireOptions + +You can configure the [BackgroundJobServerOptions](https://api.hangfire.io/html/T_Hangfire_BackgroundJobServerOptions.htm) of `AbpHangfireOptions` to customize the server. + +````csharp +Configure(options => +{ + // If no ServerOptions is set, ABP will use the default BackgroundJobServerOptions instance. + options.ServerOptions = new BackgroundJobServerOptions + { + Queues = ["default", "alpha"], + //... other properties + }; +}); +```` + +> You don't need to call `AddHangfireServer` method, ABP will use AbpHangfireOptions's `ServerOptions` to create a server. + ## Create a Background Worker `HangfireBackgroundWorkerBase` is an easy way to create a background worker.