English 中文(简体)
jBPM + 交易共享和范围
原标题:jBPM + Spring transactions sharing and scope
  • 时间:2009-10-23 09:31:40
  •  标签:

我继承了使用jBPM 和 Spring的一台器具,如果它能够配置它应该采用的方法,则试图加以说明。

First question: Does jBPM span a single JTA (JDBC and/or Hibernate) transaction across multiple actions in the same transition by default? If not, can it be configured to? So in the example below is there a way to span a transaction across Action1 and Action2.

jBPM actions in this project retrieve services or DAOs (JDBC) from Spring context. For the configuration described below, are jBPM actions and the service / DAO methods they invoke encapsulated in one transaction? DAO and service methods are annotated with @Transactional themselves.

国家定义:

<state name="SomeState">
    <event type="node-enter">
    <action class="SomeAction"/>
    </event>
    <transition name="transition1" to="finish">
    <action class="Action1"/>
    <action class="Action2"/>
    </transition>
    <transition name="transition.stop" to="finish"/>
</state>

My jBPM config:

<jbpm-configuration>

    <jbpm-context>
        <!--<service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />-->
    <service name="persistence">
        <factory>
            <bean class="org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory">
                <field name="isTransactionEnabled">
                    <false />
                </field>
            </bean>
        </factory>
    </service>
    <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
    <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
    <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
    <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
    <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
    </jbpm-context>

    <!-- configuration property used by persistence service impl org.jbpm.persistence.db.DbPersistenceServiceFactory -->
    <string name="resource.hibernate.cfg.xml" value="hibernate.jbpm.cfg.xml" />

    <!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar -->
    <string name="resource.business.calendar" value="org/jbpm/calendar/jbpm.business.calendar.properties" />
    <string name="resource.default.modules" value="org/jbpm/graph/def/jbpm.default.modules.properties" />
    <string name="resource.converter" value="org/jbpm/db/hibernate/jbpm.converter.properties" />
    <string name="resource.action.types" value="org/jbpm/graph/action/action.types.xml" />
    <string name="resource.node.types" value="org/jbpm/graph/node/node.types.xml" />
    <string name="resource.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
    <string name="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml" />
    <string name="resource.mail.templates" value="jbpm.mail.templates.xml" />

    <int name="jbpm.byte.block.size" value="1024" singleton="true" />
    <bean name="jbpm.task.instance.factory" class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl" singleton="true" />
    <bean name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" />
    <string name="jbpm.mail.smtp.host" value="localhost" />
    <bean name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" />
    <string name="jbpm.mail.from.address" value="jbpm@noreply" />

    <bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor">
    <field name="jbpmConfiguration"><ref bean="jbpmConfiguration" /></field>
    <field name="name"><string value="JbpmJobExecutor" /></field>
    <field name="nbrOfThreads"><int value="1" /></field>
    <field name="idleInterval"><int value="5000" /></field>
    <field name="maxIdleInterval"><int value="3600000" /></field> <!-- 1 hour -->
    <field name="historyMaxSize"><int value="20" /></field>
    <field name="maxLockTime"><int value="600000" /></field> <!-- 10 minutes -->
    <field name="lockMonitorInterval"><int value="60000" /></field> <!-- 1 minute -->
    <field name="lockBufferTime"><int value="5000" /></field> <!-- 5 seconds -->
    </bean>

</jbpm-configuration>

相关春季会议:

<tx:annotation-driven transaction-manager="transactionManager"/>

<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>

<bean class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
    <property name="transactionInterceptor" ref="txInterceptor"/>
</bean>

<bean id="txInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
    <property name="transactionManager" ref="transactionManager"/>
    <property name="transactionAttributeSource">
    <bean class="org.springframework.transaction.annotation.AnnotationTransactionAttributeSource"/>
    </property>
</bean>

<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"/>
最佳回答

我知道它的答复很晚(1年老问题),但也许会帮助来自谷歌或现场搜索的其他人。

您没有说明你使用哪一种JBPM,因此我假定4.x,因为当时有5个n;

JBPM在自己的交易中管理每个指挥(任务),并使用自己的交易经理从事这项工作。 因此,为了使用春天,你必须对jbpm.cfg.xml作一些改动,即:< spring-transaction-interceptor /><hibernate-session current="true”/>

This blog post should help configure all of it, though: http://blog.aparnachaudhary.net/2010/08/19/jbpm4-4-with-spring3/

问题回答

暂无回答




相关问题
热门标签