statemachine_engine_db_test.xml 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ~ Copyright 1999-2019 Seata.io Group.
  4. ~
  5. ~ Licensed under the Apache License, Version 2.0 (the "License");
  6. ~ you may not use this file except in compliance with the License.
  7. ~ You may obtain a copy of the License at
  8. ~
  9. ~ http://www.apache.org/licenses/LICENSE-2.0
  10. ~
  11. ~ Unless required by applicable law or agreed to in writing, software
  12. ~ distributed under the License is distributed on an "AS IS" BASIS,
  13. ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ~ See the License for the specific language governing permissions and
  15. ~ limitations under the License.
  16. -->
  17. <beans xmlns="http://www.springframework.org/schema/beans"
  18. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  19. xmlns:context="http://www.springframework.org/schema/context"
  20. xmlns:jdbc="http://www.springframework.org/schema/jdbc"
  21. xsi:schemaLocation="
  22. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  23. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
  24. http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
  25. <bean id="dataSource" class="org.h2.jdbcx.JdbcConnectionPool" destroy-method="dispose">
  26. <constructor-arg>
  27. <bean class="org.h2.jdbcx.JdbcDataSource">
  28. <property name="URL" value="jdbc:h2:mem:seata_saga" />
  29. <property name="user" value="sa" />
  30. <property name="password" value="sa" />
  31. </bean>
  32. </constructor-arg>
  33. </bean>
  34. <!-- 初始化数据表结构 -->
  35. <jdbc:initialize-database data-source="dataSource">
  36. <jdbc:script location="classpath:saga/sql/h2_init.sql" />
  37. </jdbc:initialize-database>
  38. <bean id="stateMachineEngine" class="io.seata.saga.engine.impl.ProcessCtrlStateMachineEngine">
  39. <property name="stateMachineConfig" ref="dbStateMachineConfig"></property>
  40. </bean>
  41. <bean id="dbStateMachineConfig" class="io.seata.saga.engine.config.DbStateMachineConfig">
  42. <property name="dataSource" ref="dataSource"></property>
  43. <property name="resources" value="saga/statelang/*.json"></property>
  44. <property name="enableAsync" value="true"></property>
  45. <property name="threadPoolExecutor" ref="threadExecutor"></property>
  46. <property name="applicationId" value="test_saga"></property>
  47. <property name="txServiceGroup" value="default_tx_group"></property>
  48. <property name="sagaBranchRegisterEnable" value="false"></property>
  49. <property name="sagaJsonParser" value="jackson"></property>
  50. <property name="sagaRetryPersistModeUpdate" value="false" />
  51. <property name="sagaCompensatePersistModeUpdate" value="false" />
  52. </bean>
  53. <bean id="threadExecutor"
  54. class="org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean">
  55. <property name="threadNamePrefix" value="SAGA_ASYNC_EXE_" />
  56. <property name="corePoolSize" value="20" />
  57. <property name="maxPoolSize" value="20" />
  58. <property name="queueCapacity" value="100" />
  59. <property name="rejectedExecutionHandler" ref="callerRunsPolicy" />
  60. </bean>
  61. <bean name="callerRunsPolicy" class="java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy">
  62. </bean>
  63. <bean class="io.seata.saga.rm.StateMachineEngineHolder">
  64. <property name="stateMachineEngine" ref="stateMachineEngine"/>
  65. </bean>
  66. <bean id="demoService" class="io.seata.saga.engine.mock.DemoService"/>
  67. </beans>