Hi,
at company i work for, we have often quite big fully automated (no user tasks) processes with quite a lot of data. Often process is started with XML (e.g. payload of webservice) and then during execution calculations for necessary provisioning steps are done. These results are stored as smaller xmls or individual fields - all as process variables. Sometimes we have maybe even 50-100 of process variables (single variable is easier to change by operations team, then more complex xml structure).
During evolution of processes, we are often solving questions like:
- can i reorder these activities?
- can i change meaning of these variable?
etc.
To answer them, we have to find all usages (reads and writes) of relevant fields and process variables.
Currently we are using some WF (work flow ~= process engine) tool where process is defined in (or can be exported into) some kind of text/xml format, where it's possible to search using fulltext search. You can imagine how much time it takes to find something, especially if it's longer chain (e.g. from input XML to process variable, then mapped to some activity, then to subprocess input xml, then again to some process variable etc.)
Camunda seems to be something similar, as BPMN is xml.
In WF tool we managed situation by implementing all
activities in way, that there is no process variable usage in process definition itself (except defining parameter itself - but this step is not necessary with camunda - which is btw. both good and bad), but
instead java implementation of underlaying activities is reading/writing process
variables, while referencing them with constants defined on single place per process (in fact it's more soffisticated, so that it's type safe, includes some validation etc). This sacrificed potential reuse (as activity was now bound to
specific names of process variables) of activity implementation, but
it's not an issue, as we don't have much reuse (and in fact, reusable
parts were moved one layer deeper, where layer called by WF is then only
mapping process variables to reusable layer).
Hence all process variables are read and written only in java, including conditions on gateways/transitions => no more need to fulltext search in XML. Process definition contains only calls to activities, but as we have dedicated package for each process definition, it's very clear without need for fulltext search.
Actually we were able to fully separate concrete activity implementation from WF engine we are using and our existing code should be usable without changes also in camunda, we only have to change framework which is glue between WF engine and implementation of activities.
I was successul to apply similar approach for service tasks with camunda, also for spawning individual processes, but so far I don't have success with subprocess called from java. Public api only supports creating of independent process instance, but in most of situations, we would like to wait for subprocess to finish, before advancing in current execution and definitelly in all cases we require to see subprocess in cockpit, so it's easy to go into subprocess (specially when something went wrong).
Hence i was digging into implementation of CallActivityBehavior to simulate it from java, but it failed on error i described before.
Do you have a hint which way to go? Or if this is right direction, how to solve it?
I started to think also about solution, where we go through bmpn file and generate java classes for that, that would represent variables usage and mappings in BPMN file, so that we can use java search.
But it is still not prefered way. Actually, while doing simple testing processes, i found myself struggling while defining process as after few steps i wasn't sure what process variable name i used, so i had to click to other activity and back quite often only to copy variable name. With java i just reference class per process type and intellisense offers all possibilities + because of compilation i can be sure i didn't make typo in variable name.
There are also other topics, where this could help us. E.g. we have requirement to see in cockpit for each activity, which variables are used for reading and writing. This will help operations team. IF always mapped in bmnm file, we could parse this. If always called from java, we could either parse, or use reflection, or even determine in runtime what is used. With last approach, we can in addition detect, which variables are declared to be used, but are not invoked for certain time, hence it's signal to inspect code and potentially remove input/output variable mapping.