-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtask-config.xml
More file actions
57 lines (54 loc) · 3.13 KB
/
task-config.xml
File metadata and controls
57 lines (54 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tf="http://www.xteam.org/taskflow"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.xteam.org/taskflow http://www.xteam.org/taskflow/tf-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<bean id="customConfig" class="taskflow.springframework.context.support.PropsToEnvironment">
<property name="locations">
<array>
<value>classpath:application.properties</value>
</array>
</property>
</bean>
<!-- XML形式注册时,若想输出注册记录,需手动配置此Bean;注解形式(SpringBoot)注册时无需配置 -->
<bean id="defaultRegisterLogPrinter" class="taskflow.config.bean.DefaultRegisterLogPrinter" init-method="init"/>
<!-- TaskBean Define -->
<bean id="numberService" class="demo.service.NumberService"/>
<bean id="findNumberTaskBean" class="demo.task.FindNumber">
<property name="numberService" ref="numberService"/>
</bean>
<bean id="calNumberTaskBean" class="demo.task.CalNumber"/>
<!-- Task Define -->
<tf:task id="findMaxTask" ref="findNumberTaskBean" method="findMax">
<!-- 当只有一个routing时,不设置key并且Task中不设置RoutingKey,将直接跳转到toTask -->
<tf:routing toTask="findMinTask"/>
</tf:task>
<tf:task id="findMinTask" ref="findNumberTaskBean" method="findMin">
<tf:routing toTask="getDiffTask"/>
</tf:task>
<tf:task id="getDiffTask" ref="findNumberTaskBean" method="getDiff" extra="{threshold:999}">
<!-- pattern取值:string或regex,默认string -->
<tf:routing key="ok" toTask="soutOutOkTask" pattern="string" extra="HighPriority_OK"/>
<tf:routing key="no" toTask="soutOutNoTask" extra="HighPriority_NO"/>
<tf:routing key="else|other" toTask="otherWorkTaskWrapper" pattern="regex"/>
</tf:task>
<tf:task id="soutOutOkTask" ref="findNumberTaskBean" method="soutOutOk" extra="LowPriority_OK"/>
<tf:task id="soutOutNoTask" ref="findNumberTaskBean" method="soutOutNo" extra="LowPriority_NO"/>
<!-- otherWork中不可再引用此taskWrapper,否则会出现死循环调用 -->
<tf:taskWrapper id="otherWorkTaskWrapper" refWork="otherWork" resultKey="otherWorkTaskWrapper">
<tf:routing toTask="calTask"/>
</tf:taskWrapper>
<tf:task id="calTask" ref="calNumberTaskBean" method="cal"/>
<tf:task id="otherTask" ref="calNumberTaskBean" method="someMethod"/>
<!-- Work Define -->
<tf:work id="subWork" start="calTask" traceable="true"/>
<tf:work id="otherWork" traceable="true" class="taskflow.work.SequentialRouteWork">
<tf:task-ref value="otherTask"/>
</tf:work>
<!-- startWork/finishWork可以指定为其它workId , 但不能指定为当前workId -->
<tf:work id="testWork" start="findMaxTask" finishWork="subWork" traceable="true"/>
<tf:workFactory/>
</beans>