C # ABP Source code detailed backgroundjob, background work (a)

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.