I am looking for a possibility to execute a buch of rules against an event that comes in, which has the rules defined in its payload. I took the rules (json) and created DmnDefinition with DmnJsonConverter.
It works it tests, I got an output variable with result, but if I place this code in Service Task in BPMN process, then I got an exception that says : “No decision found for key: decisionnew2 and tenantId: abcd.”.
I just need this decision table to be executed once against the event. Every new event comes with new set of rules, based on which I have to create new decision table.
Where I made a mistake ? Do you think my approach is correct, or this scenario could be approached better ?
When you get that error it means you created a decision task; which a specific implementation of a service task. This has additional properties available where you can define the decision key (which will be used to lookup and execute the decision at runtime).
But if I understand correctly you dynamically create, deploy and run a decision at runtime.
In this case you should use a ‘plain’ service task which has your implementation assigned to it.
EDIT:
I have dug a little deeper, and it seem that DataSource bean has to be defined. For some reason it does not work with in memory h2. “Physical” database has to be used.
Okay. So it’s solved now?
I had a look at the code and the Flowable part looks okay.
H2 works too… so if you experience issues with that it must be related to some other parts.