spring-camel-activiti-context.xml 3.0 KB
Newer Older
T
tijsrademakers 已提交
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
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:osgi="http://www.springframework.org/schema/osgi"
       xmlns:camel="http://camel.apache.org/schema/spring"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/osgi  http://www.springframework.org/schema/osgi/spring-osgi.xsd
                           http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

    <bean id="dataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
        <property name="targetDataSource">
            <bean class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
                <property name="driverClass" value="org.h2.Driver"/>
                <property name="url" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000"/>
                <property name="username" value="sa"/>
                <property name="password" value=""/>
            </bean>
        </property>
    </bean>

    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
    </bean>

    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
        <property name="dataSource" ref="dataSource"/>
        <property name="transactionManager" ref="transactionManager"/>
        <property name="databaseSchemaUpdate" value="true"/>
        <property name="jobExecutorActivate" value="false"/>
    </bean>

    <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
        <property name="processEngineConfiguration" ref="processEngineConfiguration"/>
    </bean>

    <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService"/>

    <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
        <route id="incomingRoute">
          <from uri="activiti:camelProcess:serviceTask1" />
          <setBody>
            <property>var1</property>
          </setBody>
          <to uri="mock:service1" />
          <setProperty propertyName="var2">
            <constant>var2</constant>
          </setProperty>
          <setBody>
            <mvel>properties</mvel>
          </setBody>
        </route>
        <route id="incomingRoute2">
54
          <from uri="activiti:camelProcess:serviceTask2?copyVariablesToBodyAsMap=true" />
T
tijsrademakers 已提交
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
          <to uri="mock:service2" />
        </route>
        <route id="startRoute">
          <from uri="direct:start" />
          <to uri="activiti:camelProcess" />
        </route>
        <route id="startRoute2">
          <from uri="direct:receive" />
          <to uri="activiti:camelProcess:receive" />
        </route>
    </camelContext>

    <bean id="sleepBean" class="org.activiti.camel.SleepBean"/>

</beans>