Show Table of Contents
Chapter 8. Integration with Spring
8.1. Configuring Red Hat JBoss BRMS with Spring
Refer to the Red Hat JBoss BRMS Installation Guide to download the Spring module. You will need to download the generic deployable version of JBoss BRMS.
The Spring module is present in the
jboss-brms-engine.zip file and is called kie-spring-VERSION-redhat-MINORVERSION.jar.
How you intend to use the Spring modules in your application affects how you configure them.
As a Self Managed Process Engine
This is the standard way to start using JBoss BRMS in your Spring application. You only configure it once and run as part of the application. Using
RuntimeManager API, perfect synchronization between process engine and task service is managed internally and the end user does not have to deal with the internal code to make these two work together.
As a Shared Task Service
When you use a single instance of a
TaskService, you have more flexibility in configuring the task service instance as it is independent of the RuntimeManager. Once configured it is then used by the RuntimeManager when requested.
To create a RuntimeEnvironment from your Spring application, you can use the
org.kie.spring.factorybeans.RuntimeEnvironmentFactoryBean class. This factory class is responsible for producing instances of RuntimeEnvironment that are consumed by RuntimeManager upon creation. Illustrated below is a configured RuntimeEnvironment with the entity manager, transaction manager, and resources for the class org.kie.spring.factorybeans.RuntimeEnvironmentFactoryBean:
<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>
The following RuntimeEnvironment can be created or configured:
- 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
Depending upon the selected type, there are different mandatory properties that are required. However, at least one of the following knowledge properties must be provided:
- knowledgeBase
- assets
- releaseId
- groupId, artifactId, version
Finally, for DEFAULT, DEFAULT_KJAR, DEFAULT_KJAR_CL types, persistence needs to be configured in the form of values for
entity manager factory and transaction manager. Illustrated below is an example RuntimeManager for org.kie.spring.factorybeans.RuntimeManagerFactoryBean:
<bean id="runtimeManager" class="org.kie.spring.factorybeans.RuntimeManagerFactoryBean" destroy-method="close"> <property name="identifier" value="spring-rm"/> <property name="runtimeEnvironment" ref="runtimeEnvironment"/> </bean>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.