- RuntimeManager
- enhanced timer service
- new deployment model – based on kjar and maven
- brand new tooling
- see release notes for more
- Self managed process engine
- Shared task service
org.kie.spring.factorybeans.RuntimeEnvironmentFactoryBean
- DEFAULT – default (most common) configuration for RuntimeManager
- EMPTY – completely empty environment to be manually populated
- DEFAULT_IN_MEMORY – same as DEFAULT but without persistence of the runtime engine
- DEFAULT_KJAR – same as DEFAULT but knowledge asset are taken from KJAR identified by releaseid or GAV
- DEFAULT_KJAR_CL – build directly from classpath that consists kmodule.xml descriptor
- knowledgeBase
- assets
- releaseId
- groupId, artifactId, version
- entity manager factory
- transaction manager
org.kie.spring.factorybeans.RuntimeManagerFactoryBean
- SINGLETON
- PER_REQUEST
- PER_PROCESS_INSTANCE
org.kie.spring.factorybeans.TaskServiceFactoryBean
- entity manager factory
- transaction manager
- userGroupCallback – implementation of UserGroupCallback to be used, defaults to MVELUserGroupCallbackImpl
- userInfo – implementation of UserInfo to be used, defaults to DefaultUserInfo
- listener – list of TaskLifeCycleEventListener that will be notified upon various operations on tasks
<bean id="jbpmEMF" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="org.jbpm.persistence.spring.jta"/>
</bean>
<bean id="btmConfig" factory-method="getConfiguration" class="bitronix.tm.TransactionManagerServices">
</bean>
<bean id="BitronixTransactionManager" factory-method="getTransactionManager"
class="bitronix.tm.TransactionManagerServices" depends-on="btmConfig" destroy-method="shutdown" />
<bean id="jbpmTxManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="BitronixTransactionManager" />
<property name="userTransaction" ref="BitronixTransactionManager" />
</bean>
- JTA transaction manager (backed by bitronix – for unit tests or servlet containers)
- entity manager factory for persistence unit named org.jbpm.persistence.spring.jta
<bean id="process" factory-method="newClassPathResource" class="org.kie.internal.io.ResourceFactory">
<constructor-arg>
<value>jbpm/processes/sample.bpmn</value>
</constructor-arg>
</bean>
this configures single process that will be available for execution – sample.bpmn that will be taken from class path. This is the simplest way to get your processes included when trying out jbpm.
3. Then we configure RuntimeEnvironment with our infrastructure (entity manager, transaction manager, resources)
<bean id="runtimeEnvironment" class="org.kie.spring.factorybeans.RuntimeEnvironmentFactoryBean">
<property name="type" value="DEFAULT"/>
<property name="entityManagerFactory" ref="jbpmEMF"/>
<property name="transactionManager" ref="jbpmTxManager"/>
<property name="assets">
<map>
<entry key-ref="process"><util:constant static-field="org.kie.api.io.ResourceType.BPMN2"/></entry>
</map>
</property>
</bean>
that gives us default runtime environment ready to be used to create instance of a RuntimeManager.
4. And finally we create RuntimeManager with the environment we just setup
<bean id="runtimeManager" class="org.kie.spring.factorybeans.RuntimeManagerFactoryBean" destroy-method="close">
<property name="identifier" value="spring-rm"/>
<property name="runtimeEnvironment" ref="runtimeEnvironment"/>
</bean>
with just four steps you are ready to execute your processes with Spring and jBPM 6, utilizing EntityManagerFactory and JTA transaction manager.
As an optional step, especially useful when testing you can create AuditLogService to get history information of your process executions.
<bean id="logService" class="org.jbpm.process.audit.JPAAuditLogService">
<constructor-arg>
<ref bean="jbpmEMF"/>
</constructor-arg>
</bean>
Complete spring configuration file can be found here.
- JTA and SharedEntityManager
- Local Persistence Unit and EntityManagerFactory
- Local Persistence Unit and SharedEntityManager
<bean id="taskService" class="org.kie.spring.factorybeans.TaskServiceFactoryBean" destroy-method="close">
<property name="entityManagerFactory" ref="jbpmEMF"/>
<property name="transactionManager" ref="jbpmTxManager"/>
<property name="listeners">
<list>
<bean class="org.jbpm.services.task.audit.JPATaskLifeCycleEventListener" />
</list>
</property>
</bean>
Then, step 3 needs to be slightly enhanced to set task service instance in the runtime environment so RuntimeManager can make use of it
<bean id="runtimeEnvironment" class="org.kie.spring.factorybeans.RuntimeEnvironmentFactoryBean">
<property name="type" value="DEFAULT"/>
<property name="entityManagerFactory" ref="jbpmEMF"/>
<property name="transactionManager" ref="jbpmTxManager"/>
<property name="assets">
<map>
<entry key-ref="process"><util:constant static-field="org.kie.api.io.ResourceType.BPMN2"/></entry>
</map>
</property>
<property name="taskService" ref="taskService"/>
</bean>
that will disable task service creation by RuntimeManager and always use this single shared instance.
Step 4 (creating RuntimeManager) is exactly the same.
Look at the example configuration files and test cases for more details on how they are utilized.
Please also note that factory beans for spring integration are currently scheduled to be released with 6.1.0 version of jBPM but I would like to encourage you to give it a try before so in case something is not working or missing we will have time to fix it and let it out with 6.1.0.Final. So all hands on board and let’s spring it 🙂