Discussion:
[jboss-user] [jBPM] - afterProcessCompleted() not firing when last workflow task is business rule
cold gin
2013-04-26 12:21:42 UTC
Permalink
cold gin [https://community.jboss.org/people/cold_gin] created the discussion

"afterProcessCompleted() not firing when last workflow task is business rule"

To view the discussion, visit: https://community.jboss.org/message/810546#810546

--------------------------------------------------------------
Hello. I have a workflow that contains a business rule as the last task, and exists on the flow just prior to a terminal (stop) task (jBPM 5.4.0). When this business rule task is present on the workflow definition, the afterProcessCompleted() event never fires on the DefaultProcessEventListener that I am attaching to my knowledge session. If I remove the business rule task in designer and re-execute the workflow, the event does fire on the DefaultProcessEventListener.

I do not have any special configuration anywhere else in my setup that relates to this business rule task, as I was given this workflow by a third party. The code for the business rule from designer is as follows:

<bpmn2:businessRuleTask xmlns:bpmn2=" http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/20100524/MODEL" id="_51E71516-F613-4F75-BC82-88975FD75864" drools:selectable="true" xmlns:drools=" http://www.jboss.org/drools http://www.jboss.org/drools" drools:ruleFlowGroup="Retract" name="Retract_Object">
      <bpmn2:incoming>_ABC4091E-50C7-4B41-88D9-C4592DF259E3</bpmn2:incoming>
      <bpmn2:outgoing>_D86BD4F5-5151-4D67-863B-5AAE9D56E08E</bpmn2:outgoing>
</bpmn2:businessRuleTask>

The workflow basically goes like this:

start => human task => script task => business rule task => stop    [afterProcessCompleted() does not fire]

start => human task => script task => stop     [afterProcessCompleted() fires as expected]

I am new to jBPM and drools, and I was wondering if anybody can explain this behavior, and how to get the afterProcessCompleted() event to fire? Thanks in advance for any insight.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/810546#810546]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Demian Calcaprina
2013-04-26 14:31:34 UTC
Permalink
Demian Calcaprina [https://community.jboss.org/people/calca] created the discussion

"Re: afterProcessCompleted() not firing when last workflow task is business rule"

To view the discussion, visit: https://community.jboss.org/message/810576#810576

--------------------------------------------------------------
Hey,

Is your rule task being fired?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/810576#810576]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
cold gin
2013-04-29 18:21:49 UTC
Permalink
cold gin [https://community.jboss.org/people/cold_gin] created the discussion

"Re: afterProcessCompleted() not firing when last workflow task is business rule"

To view the discussion, visit: https://community.jboss.org/message/810821#810821

--------------------------------------------------------------
Sorry it took so long to get back, as I was running some tests on this issue. I was able to solve my problem by doing the following in my process event listener:

public void afterNodeTriggered(ProcessNodeTriggeredEvent event) {
     ksession.fireAllRules();
    }

This advances the process when a business rule task is encountered. This post pointed me in the right direction towards calling fireAllRules():

https://community.jboss.org/message/627263#627263 https://community.jboss.org/message/627263

And thanks for replying Demian

--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/810821#810821]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...