Workflow API
Plug-ins map the technology interface of an individual business process to process handling. A plug-in can access special functions of an underlying software system, trigger other processes, and communicate with systems outside of the workflow system.
A plug-in accesses model- and platform-specific parameters. The model only contains ProcessEntities and ActivityEntities. The platform-specific parameters are provided through the SessionContext. Both properties are provided by the WorkflowManager through object org.imixs.workflow.WorkflowContext. A plug-in can, for instance, only access model date (e.g., a workflow history plug-in) or ignore the model and only use platform-specific parameters (e.g., a profiling plug-in).
Thanks to the concept for isolating a plug-in from the overall process, the plug-ins can be developed and used with a high degree of flexibility. A plug-in only handles a certain detail process and does not have persistence mechanisms or control functions. These are completely performed by the WorkflowKernel.
A plug-in should be developed according to the "hook & discover" principle. This means that a plug-in can attach to a WorkItem in every possible situation and integrate itself into the structure of the WorkItem. This requires the plug-in to be developed to allow analyzing and validating of the actual structure of a WorkItem, preparing the WorkItem for its own process handling. A plug-in should not assume the structure of a WorkItem but provide the required attributes itself and initialize them, if required.
This principle ensures that plug-ins can be applied to as many WorkItems as possible. The actual status of a WorkItem should not have any effect on a plug-in.
For implementing this concept, the "init()" and "run()" methods are available.
Every plug-in should support the transaction concept. The run method of an individual plug-in is always a single step within a transaction of the WorkflowKernel. The term "transaction" that was originally used in the business environment shows that this operation has a certain meaning for a process (business process).
From a technical perspective, the transaction has so-called ACID properties.
Atomicity: The actions that make up the transaction are performed either completely or not at all.
Consistency: A transaction always transforms own data resources from one consistent state into another consistent state.
Isolation: Two simultaneously running transactions are isolated from each other. This means that a transaction is not disturbed by the changes of another one.
Permanence: The changes of the transaction are permanently stored.
There is an interesting possibility of using plug-ins within transactions. For instance, this applies if different plug-in resources on different systems are to be synchronized. Typical cases are data resources on different systems that contribute to a transaction (process method). The challenge is to obtain the ACID properties of an individual plug-in.
To achieve this, the plug-in supports the concept of a two-phase commit (2PC). The WorkflowKernel assumes the role of the central coordinator. It executes the two phases that are mapped through CallBack methods "run()" and "close()" in the plug-in.
The WorkflowKernel defines a so-called PluginStack when forwarding a WorkItem to a plug-in. The PluginStack provides information about the current processing state of the WorkItem in relation to the plug-in.
The stack is organized as follows:
Itemname=$PluginStack Itemvalue=Pluginname|ProcessStartTime|ProcessEndTime
Example:
org.foo.MyPlugin | 1/1/04 03:30 AM:30| 1/1/04 03:30 AM:31; org.foo.SimplePlugin | 1/1/04 03:30 AM:31| 1/1/04 03:30 AM:32;