Session

Next, you should create a session to interact with the engine. Again, the API is knowledge-based, supporting different types of Knowledge, with a specific extension for each Knowledge Type. The following code snippet shows how easy it is to create a session based on the earlier created Knowledge Base, and to start a process.

StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ProcessInstance processInstance = ksession.startProcess("com.sample.ruleflow");

The ProcessRuntime interface defines all the session methods for interacting with processes, as shown below. Consult the Javadocs to get a detailed explanation for each of the methods.

ProcessInstance startProcess(String processId);
ProcessInstance startProcess(String processId, Map<String, Object> parameters);
void signalEvent(String type, Object event);
Collection<ProcessInstance> getProcessInstances();
ProcessInstance getProcessInstance(long id);
WorkItemManager getWorkItemManager();