JBPM 4.1 with Spring integration

Source: Internet
Author: User
Tags constructor jbpm

Jbpm4.1 Features:

4.1 is well integrated with Tomcat

4.1 provides web-based process editing capabilities

There are related integration chapters in the development Guide:

16.2. Configuration

Replace the Standard-transaction-interceptor with the Spring-transaction-interceptor. The hibernate session needs the attribute current= "true". Also, the <transaction/> must is removed from the Transaction-context if you want the transactions of handled by Spring only. This IS forces JBPM to search for the "session", which would be provided by Spring.

 <process-engine-context>
<command-service>
<spring-transaction-interceptor />
...
</command-service>
...
</process-engine-context>
<transaction-context>
...
</transaction-context>

The Spring integration provides a special context, which are added to the set of context where the JBPM engine would look fo R beans. Using This springcontext, it is now possible to retrieve beans from the Spring application context. For the "Spring context" to is known, a springconfiguration must be created. This class extends the jbpmconfiguration but would add itself as a context. The single constructor take the location of the JBPM configuration.

 <bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">
<constructor-arg value="be/inze/spring/demo/jbpm.cfg.xml" />
</bean>

The JBPM services can also be defined in the Spring ApplicationContext, as following:

<bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />
<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
<bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />

16.3. Usage

The previous section already showed to the JBPM services can be made to other Spring services. The calling Spring beans from within a process. This can is done by using a expression which resolves to the name of a Spring bean.

<java name="echo" expr="#{echoService}" method="sayHello" >
<transition name="to accept" to="join1"/>
</java>

The scripting engine'll look into all contexts from the bean named EchoService. IF you configured the ScriptManager as above, the Spring would be the "last context" to search for. can also add a spring bean to the spring application context (eg Identitysessionimpl with ID identitysession) and use It in the JBPM config (eg by adding <env class= "identitysession"/>)

The integration process is essentially the same as 4.

Jbpm.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration>
   <import resource="jbpm.default.cfg.xml" />
   <import resource="jbpm.tx.spring.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.identity.cfg.xml" />
   <import resource="jbpm.businesscalendar.cfg.xml" />
   <!-- Job executor is excluded for running the example test cases. -->
   <!-- To enable timers and messages in production use, this should be included. -->
   <!--
   <import resource="jbpm.jobexecutor.cfg.xml" />
   -->
   <import resource="jbpm.jobexecutor.cfg.xml" />
   <import resource="jbpm/jbpm.mail.templates.examples.xml" />

</jbpm-configuration>

Working calendars separated from default

Integration of XML in native Jbpm.tx.spring.cfg.xml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.