jBPM&Drools go Enterprise - JUDCon2012

Embed Size (px)

DESCRIPTION

Presentation given on JUDCon 2012 by Maciej Swiderski (jbpm core developer) about building BPM platform on top of jBPM5 and Drools.

Citation preview

  • 1. jBPM & Drools go Enterprise Maciej Swiderski

2. Build comprehensive BPMplatform on top of jBPM and Drools that will trulyaccelerate your business 3. Sounds nice but whats that?How easy is to:Introduce new (version of) process?Change logic of a process?Upgrade your environment?Migrate your active processes? 4. ... the goal is to be able... Add new (version) processes withoutaffecting already running instances Alter business logic invoked by theprocesses independently Run different versions of the engine atthe same time 5. ... the developer goal is to beable... Do not maintain knowledge sessions onapplication/client side Do not worry about version if notneeded Process version Engine version Simplify usability of the engine fromapplication/client perspective 6. JBoss AS7 to the rescue JBoss Modules jBPM and Drools configured as JBossModule with all their dependencies OSGi Engine factories registered in OSGi serviceregistry with version properties Engines registered in OSGi service registrywith custom properties Client code packaged as OSGi bundles 7. Platform overview JBoss AS7OSGi Service RegistryProcess bundleProcess bundle BPM module v 1.0jBPM & Drools Module jBPM & Drools Module V 5.2V 5.3 8. Platform components BPM module Registers resolver manager JBPM & Drools module Registers ExecutionEngineFactory Registers resolvers Platform bundle Bootstraps and registers ExecutionEngine Client application Uses ExecutionEngine via resolvers 9. BPM module Simple abstraction layer on top of jBPMand Drools APIs to make clientsindependent of the version Registers ResolverManager in OSGiservice registry as single point ofinteraction for ExecutionEngine lookups 10. ResolverManagerpublicinterfaceExecutionEngineResolverManager{voidregister(Stringowner,ExecutionEngineResolverresolver);voidunregister(Stringowner,UUIDresolverUniqueId);ExecutionEngineResolverfind(RequestContextcontext);ExecutionEnginefindAndLookUp(RequestContextcontext);CollectiongetResolvers();} 11. jBPM & Drools module jBPM and Drools components bundled in asingle JBoss Module together with alldependencies OSGi enabled Registers ExecutionEngineFactory that isexposed to process bundles to constructExecutionEngines for given version of jBPMand Drools Registers resolvers supported by givenversion 12. ExecutionEngineFactorypublicinterfaceExecutionEngineFactory{publicExecutionEnginenewExecutionEngine(ClassLoaderbundleClassLoader);publicExecutionEnginenewExecutionEngine(ClassLoaderbundleClassLoader,ExecutionEngineConfigurationconfig);publicExecutionEnginenewExecutionEngine(ClassLoaderbundleClassLoader,ExecutionEngineConfigurationconfig,Objectcallback);publicExecutionEnginenewExecutionEngine(ClassLoaderbundleClassLoader,ExecutionEngineConfigurationconfig,ExecutionEngineMapperStrategystrategy,Objectcallback);} 13. Process bundle Main component that makes use of theplatform and delivers functionality Produces ExecutionEngine which is: Wrapper around KnowledgeBase Provides session management based on business keys using configurable strategies Registers ExecutionEngine under variousproperties making it discoverable by resolvers 14. ExecutionEnginepublicinterfaceExecutionEngine{publicObjectgetKnowledgeBase();publicSessionDelegategetStatelessSession();publicSessionDelegategetSession(StringbusinessKey);publicSessionDelegategetSessionById(intid);publicObjectgetHumanTaskConnector();publicUUIDgetUUID();publicStringbuildCompositeId(Stringid);publicvoiddisposeSession(SessionDelegatesession);} 15. Platform interactions 4. Register Exec EngineProcess Bundle1. look upOSGi EE Factory Service 2. Build EE RegistryExecEngineFactory 3. Build EEResolverManagerExecutionEngine5. Optional register custom resolvers 16. Client application Ultimate client of the platform Makes use of ExecutionEngine andResolverManager to perform work Independent of the platform andprocess version Communicates only through OSGiservice registry 17. Platform interactionsClient app1. Look up OSGiResolver ManagerServiceRegistry2. find Resolverfind ExecEngine Resolver3. Look up 4. perform operationon the engine Manager exec engineExecutionEngine 18. Client application code//getreferencetoResolvermanagerServiceReferencesrf=this.context.getServiceReference(ExecutionEngineResolverManager.class.getName());ExecutionEngineResolverManagerresolverManager=(ExecutionEngineResolverManager)this.context.getService(srf);//findrightresolveranddirectlylookuptheengineRequestContextreqContext=newHttpRequestContext(request);ExecutionEngineengine=resolverManager.findAndLookUp(reqContext);//getsessionbybusinesskeyandstartprocessonitStringcompositeProcessInstanceId=engine.getSession("businesskey").startProcess(processid); 19. Resolvers Resolver is responsible for finding theright ExecutionEngine based on givencontext Default policy - first resolver thataccepts the context will do the look upin OSGi service registry Platform delivers some resolvers out ofthe box but process bundles canintroduce custom resolvers as well 20. Available default resolvers UUID based resolver that accepts context if: Explicitly contains UUID property of the engine Contains composite id property (for instance processInstanceId) Version based resolver that accepts context if: Explicitly contains version property Valid time resolver that will accepts the context if: No version parameter is given 21. Session management In case where more than one session is inuse there is a need to keep track of theidentifiers and in some cases evenrelationship between process instance andsession instance By default this need must be secured onapplication side On clustered environment things get morecomplicated (avoid concurrent usage of thesame session) 22. SessionMappingStrategies Platform is equipped with strategies that arecapable of maintaining sessions identifiersbased on some business key Application refers to the session with custombusiness key like for instance user id ordepartment instead of the internal session id Strategies are pluggable and everyExecutionEngine instance can utilize differentimplementation 23. Available session mapping strategies SerializableMap strategy dedicatedstrategy for standalone installation thatwill simply persist the map of knownvalues to the disc Clustered strategy dedicated strategythat will employ Inifinispan asdistributed cache with configured datastore 24. Make your engine configurable ExecutionEngine will emit notification onnumber of events so the processbundle can react on them: Knowledge base creation Knowledge session creation Work item registration Dispose of the session etc 25. ExecutionEngineCallbackpublicinterfaceExecutionEngineCallback{publicvoidpreKnowledgeBaseCreate(KnowledgeBuilderbuilder);publicvoidpostKnowledgeBaseCreate(KnowledgeBasekBase);publicvoidpreKnowledgeSessionCreate(Environmentenvironment,KnowledgeSessionConfigurationconfig,KnowledgeBasekBase);publicvoidpostKnowledgeSessionCreate(StatefulKnowledgeSessionsession,StringbusinessKey);publicvoidpostKnowledgeSessionCreate(StatelessKnowledgeSessionsession,StringbusinessKey);publicvoidpreKnowledgeSessionRestore(Environmentenvironment,KnowledgeSessionConfigurationconfig,KnowledgeBasekBase);publicvoidpostKnowledgeSessionRestore(StatefulKnowledgeSessionsession,StringbusinessKey);publicvoidpreSessionDispose(StatefulKnowledgeSessionsession,StringbusinessKey);publicvoidpostSessionDispose(StatefulKnowledgeSessionsession,StringbusinessKey);publicvoidpreWorkItemRegister(StatefulKnowledgeSessionsession,StringbusinessKey,KnowledgeBasekBase,WorkItemHandlerhandler);publicvoidpostWorkItemRegister(StatefulKnowledgeSessionsession,StringbusinessKey,KnowledgeBasekBase,WorkItemHandlerhandler);} 26. Multi tenancy Multi tenancy is achieved by: Separate process bundles registered withdedicated properties Additional resolver that will understandtenant configuration It could be as simple as using tenant idproperty to redirect to the rightexecution engine... 27. Still in evaluation phase... The work is still in evaluation stage soeverything can change and hopefully ifit does its for the good Please submit your input, requirements,ideas There are some limitation currently thatare being investigated and most of themhave workarounds :) 28. Still in evaluation phase... The work is still in evaluation stage soeverything can change and hopefully ifit does its for the good Please submit your input, requirements,ideas There are some limitation currently thatare being investigated and most of themhave workarounds :) 29. Thanks for your attention Questions? Comments? Email: [email protected] IRC: chat.freenode.net#jbpmTest drive:http://people.redhat.com/mswiders/jbpm-enterprise/ 30. Drools&jBPM Drools&jBPM"All Day Drop in Centre" room 105, Hynes