Slickflow. NET Open Source Workflow Engine BASICS (8 ),
Manual tasks are common in the approval process, but some automated tasks need to be triggered on a regular basis. Therefore, two problems need to be solved in the engine framework: select an appropriate task scheduling framework and integrate the new task scheduling module.
1. Select a job scheduling framework
Hangfire is an open-source. NET job scheduling framework. Currently, version 1.6 + supports. NET Core.
Queue-based task processing (Fire-and-forget jobs)
Delayed task execution (Delayed jobs)
Recurring jobs)
Continuations)
Hangfire uses the open-source NCrontab component. You can use the Cron expression syntax to specify a flexible scheduled task type.
1) Official Website address
Https://www.hangfire.io/
2) ASP. NET Website support
Http://docs.hangfire.io/en/latest/installation.html
Including installation and deployment, and database settings.
Installation steps:
Http://docs.hangfire.io/en/latest/installation.html
3) Database
During the installation of the HangFire NuGet package, the HangFire database script automatically generates HangFireDB, or you can manually generate a database.
2. The process designer supports CRON expression editing.
CRON expression editing open source project address:
Https://github.com/LGX9/cron-expression-editor
3. Slickflow. Schedule)
3.1 The process is automatically completed after the deadline
1) database fields
The process instance table WfProcessInstance contains the process instance"Expiration timeAndOverdue Processing Time"Field Information, used to record task scheduling data.
2) logical description
When the process is started or in the intermediate state, update the expiration time of the Process instance. In this way, the background scheduled job will check whether there are any overdue process instances in the process instance table. If yes, the process instance is automatically set to the final state.
3) Add a task queue
3.2 process timed start
1) database fields
The fields in the process definition table (WfProcess) contain"Timed start?AndTimed start CRON expression"Field. Defines the trigger information of a scheduled task.
2) regularly start the process node
3) join the scheduled task queue
4. Task Scheduling monitoring panel (Dashboard)
5. Summary
Integrated with the HangFire task scheduling framework, the Slickflow engine can support node task types that are automatically processed, and enhance the automatic processing capability of process tasks. At the same time, the robustness and cross-platform of the HangFire component, it can meet the business needs of most enterprise-level customers and massive job scheduling requests.