flowable / flowable-engine

A compact and highly efficient workflow and Business Process Management (BPM) platform for developers, system admins and business users.
https://www.flowable.org
Apache License 2.0
7.77k stars 2.59k forks source link

Flowable engine IntelliJ plugin #2346

Open valb3r opened 4 years ago

valb3r commented 4 years ago

Is your feature request related to a problem? Please describe.

Hello all, I've started the implementation of IntelliJ plugin for Flowable-engine at https://github.com/valb3r/flowable-bpmn-intellij-plugin You can download its MVP version from its release page that allows to navigate between your BPMN diagram and java code of i.e. ServiceTask.

Describe the solution you'd like I would like to ask for feature requests for this plugin (as I don't know what features can be useful in it for others). If someone knows what can be useful for the plugin please raise an issue at https://github.com/valb3r/flowable-bpmn-intellij-plugin/issues Maybe Flowable engine maintainers could help me with the essential feature list

Describe alternatives you've considered I've tried a multitude of IntelliJ BPMN plugins and they either are useless or can't work with Flowable dialect (also I haven't seen a plugin with BPMN diagram -> code navigation working properly)

filiphr commented 4 years ago

I've tried a multitude of IntelliJ BPMN plugins and they either are useless or can't work with Flowable dialect (also I haven't seen a plugin with BPMN diagram -> code navigation working properly)

I just checked out the video you have posted with the Diagram and the code navigation for the delegate expression. I have to say, this is extremely interesting. The code navigation part is also awesome. I'll install the plugin and play around with it a bit more next week.

valb3r commented 4 years ago

Also added debugging feature: https://github.com/valb3r/flowable-bpmn-intellij-plugin#debugging-bpmn-process-with-the-plugin

Thought I could expand it with context variables, but it seems that context variable history is not stored. I mean if the process variable is updated by i.e. ServiceTask its old version is removed from database - right?

filiphr commented 4 years ago

Just had a look at the video for the debugging. Really interesting.

What do you mean by context variable history?

valb3r commented 4 years ago

Process Instance Variable or VariableInstance java interface If I have following 2 service tasks, executed in order

class MyData {
  int version;
}

class FirstServiceTask implements JavaDelegate {
    void execute(DelegateExecution execution) {
        MyData variable = (MyData) execution.getVariable("CONTEXT");
        variable.version = 1;
        execution.setVariable("CONTEXT", variable);
    }
}

class SecondServiceTask implements JavaDelegate {
    void execute(DelegateExecution execution) {
        MyData variable = (MyData) execution.getVariable("CONTEXT");
        variable.version = 2;
        execution.setVariable("CONTEXT", variable);
    }
}

Then in the database, there will be only one instance of the "CONTEXT" variable that is associated with execution? (instance in DB will have version = 2, old instance of CONTEXT with version = 1 will not be in DB)

filiphr commented 4 years ago

OK I understand now. I think that you are looking for HistoricVariableUpdate.

Those are there for every variable update.

valb3r commented 4 years ago

Ahh... yes the point I was missing: HistoricVariableUpdate: This is only available if history level is configured to FULL so the history was not saved

valb3r commented 4 years ago

The plugin is now publicly available on JetBrains marketplace 'Flowable BPMN visualizer'

tijsrademakers commented 4 years ago

Hi @valb3r , Would you be willing to write a short piece of Flowable documentation for this plugin? It could also be some screenshots and how to install it and reference to an external link for more details for example. Best regards

valb3r commented 4 years ago

Hi @tijsrademakers, yes, sure, just tell where to add it

martin-grofcik commented 4 years ago

Hi Valentyn,

interesting! Some comments:

Re: debugging. From my point of view it is more like audit trail. , but it is just about naming. The problem could be with parallel branches which are executed in parallel. (that's a rare case but it could happen.) At the beginning you do not need to take care of such corner cases.

As a feature request may be you can consider to integrate plugin with flowable-task application. e.g. with process debugger.

The topic is really interesting. Currently I am thinking about a script task debugger integrated into eclipse/idea. BTW. Why don't you extend flowable eclipse plugin? (Idea plugin makes sense too).

Regards Martin

valb3r commented 4 years ago

Hi @martin-grofcik

Re: debugging. From my point of view it is more like audit trail. , but it is just about naming. The problem could be with parallel branches which are executed in parallel. (that's a rare case but it could happen.) At the beginning, you do not need to take care of such corner cases.

Yes, it makes sense. I plan to extend this feature with IntelliJ debugger interop, so that one could set breakpoints as well on i.e. ServiceTask by intercepting Flowable internal logic (I prefer to try to integrate it with debugger just for experience for myself, from a business standpoint it is crazy idea of course). It is not pure debugger as it won't work outside attached JVM - I wan't to try to build something like process replay eventually. You can replay any steps that were done within plugin, change code and replay again, but the state will not be limited to HistoricalVariableUpdate, but rather to entire JVM memory dump

As a feature request may be you can consider to integrate plugin with flowable-task application. e.g. with process debugger.

https://github.com/valb3r/flowable-bpmn-intellij-plugin/issues/118

BTW. Why don't you extend flowable eclipse plugin? (Idea plugin makes sense too).

To be honest I thought of it at the start but then...

  1. Repo looked abandoned to me, the plugin itself didn't meet my expectations (well maybe because I'm not Eclipse user, but I wasn't interested in investing too much time)
  2. I prefer writing 'playground' projects on the language I don't know well - so Kotlin was chosen for my plugin
  3. As I'm IntelliJ fan-boy and my team are too - we solve our business problem with my plugin and from my experience writing plugins for IntelliJ is easier

Additionally, I plan to release my plugin on Eclipse as well (sometime later)

martin-grofcik commented 4 years ago

I wan't to try to build something like process replay eventually. You can replay any steps that were done within plugin, change code and replay again, but the state will not be limited to HistoricalVariableUpdate, but rather to entire JVM memory dump

Reply and playback is tightly connected to simulations and testing. I tried to implement playback and reply on the process engine level (instead of JVM) https://gromar01.wordpress.com/2017/10/05/process-tests-without-side-effects/

valb3r commented 4 years ago

@martin-grofcik Looks very interesting. How did you manage to restore Flowable state to the preceding steps - cloning already existing instance and removing unwanted (done steps), or in some other way?

martin-grofcik commented 4 years ago

@valb3r There are several possibilities:

  1. create db dump before simulation run,
  2. start the "clean" engine and reply all events related to given process instance (I used it mostly for testing and debugging)