You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When developing the background interface, in order to improve the development efficiency, we often write serial execution codes to call different interfaces, even if there is no dependency among these interfaces, which causes the last developed interface performance is low, and the data is not convenient to reuse.
**This framework is designed to support parallel and data reuse while maintaining the development efficiency.**
16
+
**此框架目的旨在保持开发效率的同时, 很方便地支持并行和数据复用**
17
17
18
-
Of course, in an extremely high concurrent scenario, the parallel call interface is not that helpful for performance improvement. However, it doesn't mean that this project is meaningless because most applications in the Internet don't have very high concurrent traffic.
All dependencies defined by `@DataConsumer`will be got asynchronously. The provider method is executed when all the dependencies of the provider method parameters are got .
Dependencies support deep nesting. The following example has only one layer of nesting relationship.
28
+
依赖关系支持深层嵌套. 下面的示例只有一层
29
29
30
-
-**Exception handling**
30
+
-**异常处理**
31
31
32
-
Currently supports two processing methods: ignore or stop
32
+
目前支持两种处理方式: 忽略or终止
33
33
34
-
Ignore means that the provider method ignores the exception and returns a null value when it is executed. Stop means that once a provider method throws an exception, it will be thrown up step by step, and stop subsequent processing.
Exception handling configuration item supports consumer level or global level, and consumer level is priority to global level
36
+
配置支持consumer级或者全局, 优先级 : consumer级 > 全局
37
37
38
-
-**Query Cache**
38
+
-**查询缓存**
39
39
40
-
In one query life cycle of calling the Facade's query method, the result called by `@DataProvider` method may be reused. As long as the method signature and the parameters are consistent, the default method is idempotent, and the cached query result will be used directly.**However, this Not an absolute. Considering the multi-threading feature, sometimes the cache is not used.
Specify queried data id, invoke parameters, and return type to invoke `facade.get` method
149
+
指定要查询的data id, 查询参数, 返回值类型, 并调用`facade.get`方法即可
152
150
153
151
```java
154
152
User user =DataFacade.get(/*data id*/"userWithPosts",
155
-
/*Invoke Parameters*/
156
-
Collections.singletonMap("userId",1L),
157
-
User.class);
153
+
/*Invoke Parameters*/
154
+
Collections.singletonMap("userId",1L),
155
+
User.class);
158
156
Assert.notNull(user,"User must not be NULL");
159
157
Assert.notNull(user.getPosts(),"User's posts must not be NULL");
160
158
```
161
159
162
-
**Invoke result**
160
+
**运行结果**
163
161
164
-
As you can see, `user` interfaceand `posts` interfaceare executed by the asynchronous thread while `userWithPosts` service is executed by the calling thread.
162
+
可以看到, user 和posts是由异步线程执行查询, 而userWithPosts是主调线程执行, 其中
0 commit comments