Storing additional metadata for process definition

321 views
Skip to first unread message

René Peinl

unread,
Jun 3, 2015, 9:04:25 AM6/3/15
to camunda...@googlegroups.com
Hi there,
we are using camunda as a standalone workflow engine, that is used from multiple other applications. 
We need a way to store additional metadata together with the process definition in order to steer the visibility of the workflow in the different applications and sub-areas of the application.
What is the way camunda expects a developer to do this? Of course we could use an external database, but this would be really a lot overhead for a few additional attributes.
Thanks in advance for your suggestions.
Regards
René

Simon Zambrovski

unread,
Jun 3, 2015, 10:20:51 AM6/3/15
to camunda...@googlegroups.com
Hi Rene,

you can write an own extension to BPMN and put data there. Then extend the engine by adding a listener reacting on process deployment.
Is it what you think of?

Kind regards,

Simon

René Peinl

unread,
Jun 4, 2015, 5:24:56 PM6/4/15
to camunda...@googlegroups.com
Hi Simon,
thanks for the quick reply and technically sound suggestion. However, I'm not really convinced that this is the right way to go.
In my imagination, I can retrieve the metadata together with the description and category by calling getProcessDefinition().
If I store it inside the BPMN file, I have to parse it after retrieving it, which I don't do yet, so it would be quite some effort. 
I could imagine abusing the description attribute and introduce a proprietary separation character in order to store multiple structured data attributes inside.
A better solution would be to have a default mechanism to store a list of key-value pairs as extended metadata. Many systems provide such mechanisms. 
Is camunda storing everything inside the BPMN file? Is there no embedded database?
Regards
René

Daniel Meyer

unread,
Jun 5, 2015, 9:41:06 AM6/5/15
to camunda...@googlegroups.com, rene....@googlemail.com
You can also use the BPMN model API and work with extension elements in the BPMN xml:


That way you do not need to do any manual parsing, the BpmnModelInstance can be retrieved using the Repository service:

org.camunda.bpm.engine.RepositoryService.getBpmnModelInstance(String)

Cheers,
Daniel

René Peinl

unread,
Jun 11, 2015, 9:26:29 AM6/11/15
to camunda...@googlegroups.com, rene....@googlemail.com
Thanks for the hint. We've done that now and despite the ModelInstance being not much less cumbersome than usual XML Parsers, the code works in principle. However, we've run into some new issues which might or might not be directly related to that

1) We've deployed the initial version of the process with a WAR file and than updated the ModelInstance by code, generating a new version of the deployment. However, if we shutdown and restart the process engine, the WAR file is parsed again and the first version of the process is added as a new version, so that the changes in between are hidden in version 2, whereas the current version 3 is identical to version 1. Deleting the WAR file in the file system solves the problem, but is not really an option for production. Is that the expected behavior? Can we change it somehow? 

2) We have three different processes each in it's own deployment. Somehow we managed to make changes to two of them, so that they don't show up in cockpit anymore and also are not found, if we look for all process defintions with flag latestVersionOnly equals true. If we set latestVersionOnly to false, all definitions are found, including the two "lost". Is that a bug, or did we alter anything that is expected to cause this behavior? We played around with extension elements and the category

3) We've started with the "shortcut" version of adding our extension element as described here 
http://docs.camunda.org/7.3/guides/user-guide/#bpmn-model-api-extension-elements
which is working well. However, we found it a bit tedious to retrieve the element afterwards by iterating through the collection of extension elements and comparing the key. We thought that it might be more elegant to write an own class similar to the CamundaFormData example in the documentation. So we derived from BpmnModelElementInstance, but ran into an exception 
org.camunda.bpm.model.xml.ModelException: Cannot create instance of ModelType interface de.hofuniversity.iisys.camunda.bpmn.model.NuxeoAssociations: no such type registered
We have no idea where or how to register, or what we did wrong. 

Thanks in advance for any new hints.
Reply all
Reply to author
Forward
0 new messages