jBPM6 Updates

4,606 views

Published on

Overview of some jBPM6 updates

Published in: Technology
2 Comments
5 Likes
Statistics
Notes
No Downloads
Views
Total views
4,606
On SlideShare
0
From Embeds
0
Number of Embeds
27
Actions
Shares
0
Downloads
165
Comments
2
Likes
5
Embeds 0
No embeds

No notes for slide

jBPM6 Updates

  1. 1. jBPM5: Bringing more Power jBPM6 (API): to your Business Updates Processes Kris Verlaenen jBPM Project Lead September, 2013 1
  2. 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. 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. 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. 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. 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. 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. 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. 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
  10. 10. Clustering
  11. 11. Clustering • UberFire provides VFS clustering, using – Apache Zookeeper (distributed management) – Apache Helix (cluster management)
  12. 12. Clustering • jBPM Execution Server manages runtime data (RuntimeManager) – Database for synchronization • Session mgmt • Process instance mgmt • Task mgmt – Quartz for distributed timers
  13. 13. Execution Server • RuntimeManager, TaskService (and much more) • Exposed through CDI • Remoting – REST, JMS • Clustered deployment • Part of kie-wb
  14. 14. kjar Approach • Execution server can load different kbases – One runtime manager per deployment – Configure deployments
  15. 15. Remoting • KieSession and TaskService – Possibly more later – Uses RuntimeManager • Using REST or JMS • Remote client using existing interfaces
  16. 16. KieSession + TaskService API RemoteRuntime Manager Other REST Client RuntimeManager Command Kie Session Task Service R E S T J M S Task Service
  17. 17. REST API http://server.address:port/{application-id}/rest/ runtime {id: [a-zA-Z0-9-]+} // deploymentId process {id: [a-zA-Z0-9-]+} start * start process [POST] instance {id: d} * process instance details [GET] signal * signal event [POST] abort * abort process instance [POST] signal {id: [a-zA-Z0-9-]+} * signal event [POST] workitem {id: d} complete * complete work item [POST] abort * abort work item [POST] execute * execute the given command [POST] task {id: d+} * task details [GET] activate * activate task claim * claim task [POST] // etc.. execute * execute the given command [POST] query * task query
  18. 18. Command Serialization • JAXB serialization of commands – e.g. Start task <command­message>   <deploymentId>test</deploymentId>   <ver>1</ver>   <start­task>     <taskId>1</taskId>     <userId>krisv</userId>   </start­task> </command­message>
  19. 19. Result Serialization • Primitives • Simple data (JAXB) • Remote wrappers for complex data – Process Instance – Task
  20. 20. REST Client • Reuse existing interfaces – KieSession, TaskService, RuntimeManager • Factory for creating client • Uses REST execute(Command) operation – Serialized command messages
  21. 21. REST Client Example RuntimeEngine runtimeEngine = new RemoteRestSessionFactory( "org.jbpm:HR:1.0” http://localhost:8080/jbpm-console", AuthenticationType.BASIC, "krisv", "krisv") .newRuntimeEngine(); engine.getKieSession().startProcess("org.jbpm.humantask"); engine.getTaskService().start(1, "salaboy");
  22. 22. Service Task Handlers • New out-of-the-box handlers for – WS – REST • Asynchronous handler using jobs – AsyncWorkItemHandler • Reusable • Fail-safe • Retries

×