1
votes

Using the REST API for kie server, I have created a container which has the following process definition:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<process-definition>
    <process-id>someProcessId</process-id>
    <process-name>someProcessName</process-name>
    <process-version></process-version>
    <package>somepackage</package>
    <container-id>someContainerId</container-id>
    <dynamic>false</dynamic>
</process-definition>

If I try to start an instance of the process, it seems to work, using:

curl -i -u 'user:pwd!' -X POST -H 'Content-type: application/json' http://localhost:8080/kie-server/services/rest/server/containers/someContainerId/processes/someProcessId/instances

I get a HTTP 201 Created response.

However if I then get a list of process instances, the list is empty. Using:

curl -i -u 'user:pwd!' -X GET http://localhost:8080/kie-server/services/rest/server/queries/containers/someContainerId/process/instances

I receive:

My .drl file has the same ruleflow-group defined for each rule, and the .bpmn defines a start event and businessRuleTask with that ruleflow-group defined:

BPMN:

<process processType="Private" isExecutable="true" id="someProcessId" name="someProcessName" tns:packageName="somepackage" >

    <!-- nodes -->
    <startEvent id="_1"  isInterrupting="true"/>
    <endEvent id="_jbpm-unique-0" name="End" >
        <terminateEventDefinition />
    </endEvent>
    <businessRuleTask id="_jbpm-unique-2" name="someBusinessRuleTask" g:ruleFlowGroup="someRuleflowGroup" >
      <ioSpecification>
        <inputSet>
        </inputSet>
        <outputSet>
        </outputSet>
      </ioSpecification>
    </businessRuleTask>

    <!-- connections -->
    <sequenceFlow id="_jbpm-unique-2-_jbpm-unique-0" sourceRef="_jbpm-unique-2" targetRef="_jbpm-unique-0" />
    <sequenceFlow id="_1-_jbpm-unique-2" sourceRef="_1" targetRef="_jbpm-unique-2" />

  </process>

If I remove the ruleflow-group from the DRL, I can simply fire all rules (and don't even need the BPMN), but would like to understand how processes work in the kie server and how to start them.

I should add that I am separately inserting a java.util.Map object which the rules use.

Apologies if it seems like a relatively basic question, but from what I can see it should start the process instance so not sure what I'm missing.

Thanks.

1

1 Answers

0
votes

From jBPM's Documentation:

When a Rule Task is reached in the process, the jBPM engine will start executing rules that are part of the corresponding ruleflow-group (if any). Execution will automatically continue to the next node if there are no more active rules in this ruleflow group.

If your process is just a single Business Rule Task, once started, it will run until the <endEvent> node and terminate. When you ask for your process instances, you will not get any, because the instance you just created is already terminated.

Hope it helps,