Kogito editing rules in DMN via REST API or code

794 views
Skip to first unread message

Delyn Choong

unread,
Jun 30, 2022, 12:28:14 AM6/30/22
to Kogito development mailing list
Hi all, 

I'm looking for a way to dynamically add rules to the DMN on runtime via REST API or code, for example, a POST request that can add this rule condition to an existing DMN table:

if amount more than 5000, then assigned approver is the manager
{
 "amount" : >5000,
"assignedApprover": "manager"
}

As far as I'm aware there are POST requests that only seems to return decision results in json but none to add a new rule. Appreciate your inputs.

Thank you.

Matteo Mortari

unread,
Jun 30, 2022, 5:04:00 AM6/30/22
to Kogito development mailing list
Hi Delyn,
as you noticed, Kogito platform in general provides automatic REST API generation for dmn/rule/process evaluation.

If you want to programmatically modify dmn/rule/process assets, the Kogito platform do not supply out of the box REST methods to do so.

You can, however, roll your own.
For instance, you could write on Quarkus a REST API that modify specific knowledge assets based on your needs.
However, please notice that Kogito platform expects knowledge assets fixed at compile-time.
So in turn I would separate the problem on 2 parts.
You could create a Quarkus app that modify the dmn/rule/process based on your needs.
On modification, the source of a Kogito-based-on-Quarkus app is re-build and re-deployed.
This way, you don't need to heavily customise any Kogito internals, and in fact you are drawing very close to a Continuous Delivery approach.

What do you think?
Hope this helps!
MM

--
You received this message because you are subscribed to the Google Groups "Kogito development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kogito-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kogito-development/ff25e107-86aa-4d17-b0a1-aad86e94dbe0n%40googlegroups.com.


--

Delyn Choong

unread,
Jul 4, 2022, 4:50:33 AM7/4/22
to Kogito development mailing list
HI Matteo, 

Thanks for your input. Excellent point. If Kogito doesn't have this inbuilt feature then will have to look into Quarkus as alternative to modify and a pipeline to deploy. 

Will check it out. 

Thank you!

Matteo Mortari

unread,
Jul 4, 2022, 5:09:46 AM7/4/22
to Kogito development mailing list
Thanks for the feedback Delyn!
I invite you to keep the community updated with your developments, as now I recall others have implemented similar use-case as yours.
It would be interesting to eventually summarize the several architectures the community has experimented with, etc 

Hope this helps,
MM

Rhett S

unread,
Jul 10, 2022, 2:32:00 PM7/10/22
to Kogito development mailing list
Delyn,
Average community member here. :-)

I appreciate the motivation behind your request. I have seen similar scenarios/needs from my experience.

You definitely can write custom logic to change loaded (or load new) DMNs in memory using DROOLS at runtime but it wont be possible with the kogito tool. For instance, the KIE JITExecutor (https://github.com/kiegroup/kogito-apps/tree/main/jitexecutor)  does something like what you need- but it does so with a PUT approach versus a PATCH, and does not implement the actual in-memory persistence. (drawing an analogy to HTTP verbs)

however, MM and his team do not recommend the JITExecutor for production. And i agree- JITExecutor does not have robust design controls by itself. It still is really awesome if used as intended. R

Reply all
Reply to author
Forward
0 new messages