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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?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:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 分布式事务配置 start -->
<!-- 配置线程池-->
<bean name="executor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="15"/>
<property name="maxPoolSize" value="25"/>
<property name="queueCapacity" value="100"/>
</bean>
<bean name="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- 配置调度任务-->
<bean name="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="configLocation" value="classpath:job.properties"/>
<property name="dataSource" ref="dataSource"/>
<property name="transactionManager" ref="transactionManager"/>
<!-- 任务唯一的名称,将会持久化到数据库-->
<property name="schedulerName" value="baseScheduler"/>
<!-- 每台集群机器部署应用的时候会更新触发器-->
<property name="overwriteExistingJobs" value="true"/>
<property name="applicationContextSchedulerContextKey" value="app_schedule_key"/>
<property name="jobFactory">
<bean class="pwc.taxtech.atms.common.schedule.AutowiringSpringBeanJobFactory"/>
</property>
<property name="triggers">
<list>
<ref bean="lgApiJobTrigger"/>
<ref bean="orgSyncJobTrigger"/>
</list>
</property>
<property name="jobDetails">
<list>
<ref bean="lgGlBalanceJob"/>
<ref bean="orgSyncJob"/>
</list>
</property>
<property name="taskExecutor" ref="executor"/>
</bean>
<!-- 配置Job详情 -->
<bean name="lgGlBalanceJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass" value="pwc.taxtech.atms.common.schedule.LgGlBalanceJob"/>
<property name="durability" value="true"/>
<property name="requestsRecovery" value="false"/>
<property name="description" value="科目余额数据同步"/>
</bean>
<!-- 定时任务 -->
<bean id="lgApiJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="lgGlBalanceJob"/>
<property name="cronExpression" value="0 0 1 3 * ?"/>
</bean>
<bean name="orgSyncJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass" value="pwc.taxtech.atms.common.schedule.OrgSyncJob"/>
<property name="durability" value="true"/>
<property name="requestsRecovery" value="false"/>
<property name="description" value="机构信息同步"/>
</bean>
<!-- 每月1日执行一次-->
<bean id="orgSyncJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="orgSyncJob"/>
<property name="cronExpression" value="0 0 0 1 * ?"/>
</bean>
<!-- 分布式事务配置 end -->
</beans>