Showing posts with label bpmn20. Show all posts
Showing posts with label bpmn20. Show all posts

Saturday, December 6, 2014

Activiti BPM workflow engine execution pattern


This would be my part of contribution towards spreading awareness on how Activiti BPM engine might work internally. Any corrections on this particular blog is much appreciated. With that, i will proceed.

As most of the Activiti BPM developers who access the engine API programmatic-ally should be knowing that it exposes services as APIs to interact with it. I have taken this below image from Activiti website.



    Courtesy of Activiti BPM Website


What is a ProcessEngine?

As most of you know that, Activiti Engine is called as "Process Engine" as shown in the above diagram. It takes a configuration file such as 'activiti.cfg.xml' and configures itself by default and presents an instance of fully configured BPM engine called "Process Engine".

As part of customization to plugin our own identity service into ProcessEngine, I have been studying the internal workings of it. I became bit curious to understand how it perform group creation, user creation etc,.

How Command Pattern is related to ProcessEngine?


From the API names, it was evident that most of the actions such as Create User, Delete User, Create Group, Get Group Details are executed using Command Pattern. You can read more about Command Pattern in in-detail Martin Fowler's blog, http://martinfowler.com/bliki/DecoratedCommand.html. Please do read, it is quite informative...  :)

Moving on, chaining of command interceptors


Consider a scenario where as a API developer, I would like to use IdentityService for creation of new group say, "sales". To achieve the same, IdentityServiceImpl Java Class makes use of preconstructed Command Executor instance which holds a chain of command interceptors such as log interceptor, transaction interceptor, command context interceptor and finally points to command invoker which actually performs create group operation.

NOTE: The default chaining of command interceptors and command invoker happens during ProcessEngine bootstrap.

All these services exposed as APIs are injected with this command executor which carries a set of pre-configured command interceptors such as log interceptor, transaction interceptor, command context interceptor and last but not least, the actual command invoker which happens to be the last one in the interceptor chain.

Observe for blocks marked in purple color showing the command interceptor chaining.








I will keep posting the details which would be helpful to understand the internal workings of Activiti Engine.




Please note that, Activiti user guide is quite informative even though internal implementation classes carry little or no java documentation. Please follow Activiti user guide for understand engine better, http://activiti.org/userguide/index.html



Tuesday, October 21, 2014

Standalone activiti modeler/editor

  • I have made good progress with respect to extracting the activiti-modeler  editor component out of activiti framework codebase.
  • I am able to host it as part of my sample web application.
  • I have taken the latest activiti-modeler component which is 5.17.0-SNAPSHOT. I built it locally after forking out the code base from GitHub.
  • The activiti-modeler editor requires valid model id to open the editor in the form of request parameter(/service/editor?id=<model-id>). It is done in that way. As a result, even activiti-explorer loads a demo-model definition by default to provide base linking between activiti-explorer and activiti-modeler. Model ID is bit different from BPMN process definition. Seems like there is bit of difference in representation. This is one area of investigation.
  • Activiti-modeler has REST layer written using Spring MVC and Spring REST modules.
  • Activiti-modeler has certain parts which are extracted from acitiviti-explorer-web-2 maven module.
  • I have tweaked and created REST resource which will load the sample model definition and proceed with loading the activiti modeler editor. I have attached below snapshot when the sample web application was running locally,








Defining/modifying/deploying the business processes using eclipse activiti designer as well as activiti modeler

1.       Eclipse designer plugin
a.       You can create your process definition using this plugin.
b.      The eclipse designer plugin will allow you(BPMN developer) to add activiti diagram via eclipse wizard.

c.       Eclipse designer plugin allows to create deployment artifacts(.bar –business archive) which can be deployed using activiti-explorer.

d.      Eclipse designer plugin stores the process definitions file in the form of .bpmn extension file.


2.       Activiti Modeler component
  • It accepts the process definition artifacts for deployment  in any of these formats - .bar, .zip, .bpmn or .bpmn20.xml
  • Developer or Non-technical person can edit/modify the  uploaded process definition using activiti-modeler
  • Once it is modified, process definition can be deployed or exported in .bpmn20.xml format.
  • Developer can also define new processes using Activiti-modeler.