Browse Source

Update index.md

pull/25059/head
SALİH ÖZKARA 7 months ago
parent
commit
d3f9a643c8
  1. 10
      docs/en/framework/infrastructure/background-jobs/index.md

10
docs/en/framework/infrastructure/background-jobs/index.md

@ -197,13 +197,15 @@ Enqueue method gets some optional arguments to control the background job:
* **priority** is used to control priority of the job item. It gets an `BackgroundJobPriority` enum which has `Low`, `BelowNormal`, `Normal` (default), `AboveNormal` and `Hight` fields. * **priority** is used to control priority of the job item. It gets an `BackgroundJobPriority` enum which has `Low`, `BelowNormal`, `Normal` (default), `AboveNormal` and `Hight` fields.
* **delay** is used to wait a while (`TimeSpan`) before first try. * **delay** is used to wait a while (`TimeSpan`) before first try.
### Queue by Job Name ### Enqueue by ABP Job Name
You can also enqueue jobs by their name at runtime: You can also enqueue jobs by their ABP background job name at runtime:
```csharp ```csharp
var jobName = BackgroundJobNameAttribute.GetName<EmailSendingArgs>(); // "emails" if configured via [BackgroundJobName]
await _backgroundJobManager.EnqueueAsync( await _backgroundJobManager.EnqueueAsync(
"emails", jobName,
new new
{ {
EmailAddress = "user@abp.io", EmailAddress = "user@abp.io",
@ -213,6 +215,8 @@ await _backgroundJobManager.EnqueueAsync(
); );
``` ```
`jobName` here is the ABP background job name (configuration key), not a provider queue name (like a Hangfire queue or RabbitMQ queue).
In this case, ABP resolves the target job configuration by `jobName` and serializes the `args` object. In this case, ABP resolves the target job configuration by `jobName` and serializes the `args` object.
If the `args` runtime type does not match the configured argument type, ABP normalizes the payload by serializing and deserializing it to the expected argument type. If the `args` runtime type does not match the configured argument type, ABP normalizes the payload by serializing and deserializing it to the expected argument type.

Loading…
Cancel
Save