1. Introduction
If you need to implement a streaming process, especially embedded, and you want it to be easy to configure, expand, manage, and maintain. Do you need a fully functional BPM engine: The engine has its own abstract load, which seems too unwieldy for the simple process choreography you're looking for, or what lightweight alternatives are available so that we don't have to adopt a full-featured BPM engine? This article describes how to use aspect-oriented programming (AOP) technology to build and orchestrate highly configurable, scalable, lightweight embedded process flows (process flow). The current example is based on spring AOP and Aspect J, and other AOP technologies can achieve the same results.
2. The question
Before we go any further, we need to get a better understanding of the actual problem, and then try to match our understanding of the problem with a set of available patterns, tools, and/or techniques to see if we can find a suitable one. Our problem is a process itself, so let's take a good look at it. What is a process? A process is a collection of coordinated activities that result in the achievement of a set of goals. Activity is a unit of instruction execution, which is an essential part of a process. Share data (context) in part of each active operation to achieve part of the overall goal of the process. The various parts of the process objectives that have been implemented represent the facts (facts), which are used to coordinate the execution of the remaining activities. This essentially redefined the process as a rule pattern that operates on the fact set to coordinate the execution of those activities that define the process. In order for the process to coordinate activities to execute, it must know the following properties:
Activities-defining the activities of the process
Shared data/context--the fact that the mechanisms and activities that define shared data are accomplished
Transfer rules--based on registered facts, define which live after the previous activity ends
Executing decisions--defining mechanisms for implementing transfer rules
Initialization data/context (optional)--initialization status of shared data manipulated by the process
The following figure shows the high-level structure of the process:
We can now formalize a process with the following requirements set:
Defines a mechanism for assembling a process into a set of activities
Define individual activities
Define placeholders for shared data
Define mechanisms for coordinated execution of these activities within the scope of the process
Define transfer rules and execute decision mechanisms to execute the transfer rules based on the facts registered by the activity