How to extend Flowable to add "Business Domain" specific BPMN elements

Hi,

I’m trying to understand the correct way to do this in Flowable - (As a background, I have only used Flowable from a Modeling perspective using the Flowable apps, and dont know much about the Flowable source code).

Here’s the requirement we are looking to implement:

  1. We have a requirement to add “Business Domain” specific BPMN Tasks (i.e. similar to java service task , script task, HTTP Task etc., BUT at a higher Business Domain level. E.g. a BOMN Task that would update a SCADA system / ERP with some specific domain logic, that can be re-used in multiple business processes via the Modeler). At a high level, the idea is to create a repository of BPMN Tasks useful for a particular Business Domain that our users can pick and choose from the Flowable Modeler UI palette when modeling the Process.

  2. We are interested in what is the right way to “extend” (rather than “modify”) Flowable to achieve the above requirement. I.e. ideally, we are hoping there is an established way of “extending” Flowable based on Open-Closed Principle (OCP), without modifying the existing source code files (too much at least).

When I searched, I found the following pull request that adds the “HTTP Task” functionality to Flowable:


https://github.com/h7kanna/flowable-engine/commit/1806e24aff528beec3476a672a060e1439dd94df

We want something similar to the above, but the Tasks we add will be more “business domain” related. Also, from the “HTTP Task” pull request, it looks like the implementation of that functionality has modified a lot of the Flowable source code to add the Http Task functionality (hence, it looks more of “modification”, rather than “extension”? Again, apologies for my limited knowledge of Flowable source).

Would we have to go by the same approach used above for the HTTP Task, or, is there an easier way of doing it with minimal code changes?

To generalize the requirement, basically, we are looking at the correct way to “extend” Flowable with “custom” BPMN elements, while minimizing direct “modification” of the existing Flowable source code as much as possible (i.e. ideally, we are looking for an approach where we can drop in the new business domain tasks we create as “plugin” jars that would be picked by Flowable, and a similar approach on the UI side).

Could you please advice on the best way going about our requirement?

Thank You for reading this long post!

Kind Regards,
Mohsin

1 Like

Hi Mohsin,

It is a similar effort as the HTTP task PR, but that one added a lot of functionality, so for your implementation this will probably be a lot less. You would need to add your task types to the Modeler by modifying the stencilset_bpmn.json file. These new task types need a JSON converter in the flowable-json-converter module, so they get translated into a service task or another BPMN task type. When a specific Spring bean or Java class is used for these task types you can create a service task with the Spring bean name or Java class name set directly in the JSON converter. When these Task Java class are on the classpath that’s about it to make it run.

Best regards,

Tijs

Hi Tijs,

Thanks a lot for your quick response. Will try it out and update you.

Kind Regards,
Mohsin

We are planing to do the same (extend Flowable with custom BPMN elements).

Therefore I am very interested in any experiences/tips anybody would like to share.

Thanks,
Pascal

Another example (buried in tons of another functionality) is in the PR

modified stencilset:


changed converter:

Regards
Martin

1 Like

Thanks for the input.

In case anybody is interested: I managed to build a working prototype with a custom “domain specific” BPMN task based on the service task. To achive this I had to fork the following flowable modules:

  • flowable-json-converter (added converter for the custom task, modified existing classes related to service task)
  • flowable-process-validation (is is not possible to deploy processes with unknow bpmn elements, therefore ServiceTaskValidator must have knowledge of the custom servicetask type)
  • flowable-ui-modeler-logic (stencilset_bpmn.json: added stencil and propertyPackages for custom bpmn element)
  • flowable-ui-modeler-app (use custom flowable-json-converter, flowable-ui-modeler-logic and flowable-process-validation dependencies)
  • flowable-engine (ServiceTaskParseHandler must have knowledge of the custom servicetask type, otherwise no behavior is executed)
4 Likes

Hi,
As I am new to flowable I am finding it difficult to implement the above steps can you please elaborate what are the modifications required.