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
No comments:
Post a Comment