Business Framework
Introduction
The business framework is responsible for simplifying business logic implementation, allowing developers to start coding business logic quickly.
For each action, the framework combines design patterns such as Singleton, Flyweight, and Command. Action lookup is done via arrays, which is close to a near-native style. In single-thread mode, the business framework executes an average of 11.52 million business operations per second.
The business framework handles action processing, thread scheduling, JSR380 validation, and more.
Action Processing Flow
We introduced Action earlier. Here is a brief recap. Actions are defined by developers. A method defined in an action class represents an action, as shown below:
@ActionController(1)
public class DemoAction {
@ActionMethod(1)
String here(String name) {
return name + ", I'm here";
}
The framework provides default implementations for the interfaces in the flow diagram. If there are special business requirements, developers can customize implementations to replace any stage in the flow.
see DefaultFlowExecutor
- ActionMethodInOut: is a business framework plugin.
- 1 ActionFactoryBean: responsible for creating custom Actions.
- 2 ActionMethodInvoke: invokes developer-written actions.
- 3 ActionAfter: sends data to the requester.
BarSkeletonBuilder
BarSkeletonBuilder is the business framework builder.
- code 6: add a business framework plugin
public class DemoLogicServer implements LogicServer {
@Override
public void settingBarSkeletonBuilder(BarSkeletonBuilder builder) {
...
// Add console output plugin
builder.addInOut(new DebugInOut());
}
}
Developers can further extend the business framework, for example: