John Manak
John Manak

Reputation: 13558

StatelessKnowledgeSession and Drools Flow

Is it possible to run a Drools Flow process from a StatelessKnowledgeSession? If so, how? It doesn't have the startProcess(id, params) method and seems to only implement rule functionality. I have a service whose method runs a process. So far, I've used one StatefulKnowledgeSession but I read that it's not thread-safe. One solution I came up with is to inject a knowledge base and create a new session for every call of this method, but that seems like a waste of resources.

Upvotes: 0

Views: 1257

Answers (2)

Ricardo
Ricardo

Reputation: 26

Completing the other answer, you can use like this:

ksession.execute(CommandFactory.newStartProcess(theName, parameters));

Upvotes: 1

Kris Verlaenen
Kris Verlaenen

Reputation: 2918

StatelessKnowledgeSession has a method execute(..) where you can pass a set of commands. One of those could be a startProcess command.

Upvotes: 1

Related Questions