2. vs jBPM5 API?
• 2 important interfaces
– KieSession (ProcessRuntime)
– TaskService
• kjars, mavenized
– Now also contains forms, data model, etc.
• RuntimeManager
• jBPM Services (CDI)
• Remote (REST / JMS) API
3. Session Management
• Runtime Manager
– Local KieSession, local TaskService
• Hides setup complexity
– Manages sessions
• Singleton session
• Session per request
• Session per process instance
– Disposal
4. Session Management Example
RuntimeManager manager =
RuntimeManagerFactory.Factory.get()
.newPerProcessInstanceRuntimeManager(environment);
RuntimeEngine runtime =
manager.getRuntimeEngine(
ProcessInstanceIdContext.get(id));
KieSession ksession = runtime.getKieSession();
// do something here, e.g.
ksession.startProcess(“org.jbpm.hello”);
manager.disposeRuntimeEngine(engine);
manager.close();
5. Example1: Singleton session on multiple nodes
Node1
Runtime
Manager
Kie
Session
Task
Service
Request1
Request2
PrInst1
PrInst2
Request3
Node2
Runtime
Manager
Kie
Session
Task
Service
6. Example2: Session per process instance on multiple nodes
Kie
Session
Runtime
Manager
Task
Service
Node1
Kie
Session
Task
Service
Request1
Request2
PrInst1
PrInst2
Request3
Node2
Runtime
Manager
Kie
Session
Task
Service
7. jBPM Services (CDI)
• Inject services into your CDI
environment
@Inject @Singleton RuntimeManager
singletonManager;
@Inject TaskService taskService;
• Need to configure (@Produces) EMF,
environment, usergroupcallback
8. Timer Management
• Shared Timer Service
– One timer service per RuntimeManager,
manages timers of all sessions
– Restores sessions if timer fires
• No need anymore to keep sessions alive
• Using Quartz
– Timers persisted in database
– Clustering
• Timer will only fire on one and exactly one node
9. Clustering
• Clustering for
– High availability
– Load balancing
• Because
– All data always persisted in database
– Any node in the cluster can execute any
request
– Distributed timers
12. Clustering
• jBPM Execution Server manages
runtime data (RuntimeManager)
– Database for synchronization
• Session mgmt
• Process instance mgmt
• Task mgmt
– Quartz for distributed timers
13. Execution Server
• RuntimeManager, TaskService (and
much more)
• Exposed through CDI
• Remoting
– REST, JMS
• Clustered deployment
• Part of kie-wb
14. kjar Approach
• Execution server can load different
kbases
– One runtime manager per deployment
– Configure deployments
15. Remoting
• KieSession and TaskService
– Possibly more later
– Uses RuntimeManager
• Using REST or JMS
• Remote client using existing interfaces