This article is owned by the author and forwarded please indicate this article link.
1. Preface
The backgroundjob of the ABP is used to handle time-consuming operations. For example, the client uploads files, we have to do the file (Excel) processing, this time-consuming operation we should put in the back-end workers to do, so that users will not have a ' delay ' feeling.
The backgroundjob of the ABP is run in a inmemorybackgroundjobstore, it simply defines a dictionary to store the job, and the traversal runs. Of course, feel uncomfortable can do transformation.
2. class diagram study
I've sorted out some of the Backgroundjob class diagrams, as follows:
1) irunnable is defined as the opening and stopping of threads. Because Backgroundjob is plainly the boot thread is running continuously.
2) Ibackgroundjobmanager, defines the management of the job, such as the job put in the queue to run.
3) Periodicbackgroundworkerbase, control the operation of the thread Abptimer, stop, wait and so on.
4) Ibackgroundjobstore, define the INSERT, delete, UPDATE, query background workers. Now background workers are stored in member (implemented with Inmemorybackgroundjobstore), and you can transform them into databases and cloud queues.
3. Backgroundjobstore in the ABP zero module
We open the Backgroundjob package in the ABP Zero module, releasing only one class Backgroundjobstore. It implements the Ibackgroundjobstore and puts the job into the database for processing. This improves security, but performance is low and needs to be seen in our actual business.
There is a backgroundjobinfo storage (Repository) in the Backgroundjobstore, which is used to store all job.
In the next article, it will be reformed. Because our system is a high-concurrency system
C # ABP Source code detailed backgroundjob, background work (a)