Bug 1206506 - Task event listener configured through kie-module-deployment-descriptor.xml only fires for addTask events
Summary: Task event listener configured through kie-module-deployment-descriptor.xml o...
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BPMS Platform 6
Classification: Retired
Component: jBPM Core
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ER4
: 6.2.0
Assignee: Alessandro Lazarotti
QA Contact: Jakub Schwan
Dawn Eisner
URL:
Whiteboard:
: 1271904 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-03-27 10:11 UTC by Bernard Tison
Modified: 2020-03-27 20:11 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-27 20:11:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
process kjar (6.15 KB, application/zip)
2015-03-27 10:11 UTC, Bernard Tison
no flags Details
maven project (6.14 KB, application/zip)
2015-03-27 10:12 UTC, Bernard Tison
no flags Details
6.1.0.ER6 server log with correct output (180.73 KB, text/plain)
2015-03-31 10:02 UTC, Maciej Swiderski
no flags Details

Description Bernard Tison 2015-03-27 10:11:30 UTC
Created attachment 1007163 [details]
process kjar

Description of problem:

A TaskLifeCycleEventListener implementation is configured for a kjar through the kie-module-descriptor.xml.
Only the beforeTaskAddedEvent and afterTaskAddedEvent methods of the TaskLifeCycleEventListener implementation are executed during the lifecycle of the task. E.g. when a task is claimed, we expect the beforeTaskClaimedEvent and afterTaskClaimedEvent methods to be executed, but that doesn't happen.


Version-Release number of selected component (if applicable):
6.1.0.ER6

How reproducible:
Always reproducible

Steps to Reproduce:
1. On BPMS, create a user with role 'reviewer'
1. Deploy the attached kjar to BPMS. 
* The kjar has a kie-deployment-descriptor.xml descriptor file which defines a task-event-listener. The TaskLifeCycleEventListener implementation does a System.out.println() for every method defined in the listener.
* The kjar contains a process with process ID 'UserTask', which has a user task node assigned to the group 'reviewer' 
2. Start an instance of the process 'UserTask'
3. Claim, start, complete the user task

Actual results:

in the BPMS server log:

09:41:08,782 INFO  [stdout] (http-/172.17.0.7:8080-2) BeforeTaskAdded
09:41:08,808 INFO  [stdout] (http-/172.17.0.7:8080-2) AfterTaskAdded


Expected results:

in the BPMS server log:

09:41:08,782 INFO  [stdout] (http-/172.17.0.7:8080-2) BeforeTaskAdded
09:41:08,808 INFO  [stdout] (http-/172.17.0.7:8080-2) AfterTaskAdded
............ INFO  [stdout] (http-/172.17.0.7:8080-2) BeforeTaskClaimed 
............ INFO  [stdout] (http-/172.17.0.7:8080-2) AfterTaskClaimed
............ INFO  [stdout] (http-/172.17.0.7:8080-2) BeforeTaskStarted 
............ INFO  [stdout] (http-/172.17.0.7:8080-2) AfterTaskStarted
............ INFO  [stdout] (http-/172.17.0.7:8080-2) BeforeTaskCompleted 
............ INFO  [stdout] (http-/172.17.0.7:8080-2) AfterTaskCompleted

Additional info:

attached:
* kjar to reproduce the issue
* maven project with source for the kjar

Comment 1 Bernard Tison 2015-03-27 10:12:08 UTC
Created attachment 1007164 [details]
maven project

Comment 3 Maciej Swiderski 2015-03-27 11:11:32 UTC
Bernard,

just executed your kjar on fresh build of 6.2.x branch and here is the result:
12:09:43,227 INFO  [stdout] (http-/127.0.0.1:8080-5) BeforeTaskAdded
12:09:43,254 INFO  [stdout] (http-/127.0.0.1:8080-5) AfterTaskAdded
12:09:50,460 INFO  [stdout] (http-/127.0.0.1:8080-2) BeforeTaskClaimed
12:09:50,471 INFO  [stdout] (http-/127.0.0.1:8080-2) AfterTaskClaimed
12:09:50,472 INFO  [stdout] (http-/127.0.0.1:8080-2) BeforeTaskStarted
12:09:50,481 INFO  [stdout] (http-/127.0.0.1:8080-2) AfterTaskStarted
12:09:52,826 INFO  [stdout] (http-/127.0.0.1:8080-2) BeforeTaskCompleted
12:09:52,905 INFO  [stdout] (http-/127.0.0.1:8080-2) AfterTaskCompleted

I used UI to perform operations on task, have you used REST or other remote API for this?

Comment 4 Bernard Tison 2015-03-27 11:27:23 UTC
Maciej,

I used both UI and REST, and only see the BeforeTaskAdded and AfterTaskAdded events.
Please note that I am using jboss-bpmsuite-6.1.0-ER6, not a community branch.

Comment 5 Maciej Swiderski 2015-03-27 11:30:14 UTC
ok, 6.2.x should be almost (if not exactly) the same as product bits for 6.1. Anyway, I'll download ER6 and try it there

Comment 6 Maciej Swiderski 2015-03-31 10:02:58 UTC
Created attachment 1008920 [details]
6.1.0.ER6 server log with correct output

Bernard,

just tried on 6.1.0.ER6 (jboss-bpmsuite-6.1.0.ER6-installer.jar) and all event listener methods are invoked as expected. See attached server log from clean installation on EAP 6.4

Comment 7 Bernard Tison 2015-03-31 10:48:26 UTC
Hi Maciej,

It only works as expected if you use SINGLETON runtime strategy. When you deploy with PER_PROCESS_INSTANCE or PER_REQUEST strategies, only BeforeTaskAdded and AfterTaskAdded events are fired.

Comment 8 Maciej Swiderski 2015-03-31 11:18:54 UTC
Spot on Bernard, and apologies for not trying other strategies but only the default one. I am fixing this as this is a matter of initialization since in 6.1 we have lazy init of components of RuntimeEngine so until it not used it won't be initialized. In this example since we use TaskService ksession is not initialized and because of that listeners are not registered. This is obviously wrong as task listeners should be registered.

Until fix is applied you can use workaround to use eager initialization by setting system property:
-Dorg.jbpm.rm.engine.eager=true

that should make the listeners work as expected. The fix is on its way...

Comment 9 Maciej Swiderski 2015-03-31 12:51:30 UTC
fixed on master

jbpm
master:
https://github.com/droolsjbpm/jbpm/commit/3ea7e2c42151d6c00b7fb7795d98ba8138211055

Comment 12 Kris Verlaenen 2015-10-16 15:03:52 UTC
*** Bug 1271904 has been marked as a duplicate of this bug. ***

Comment 13 Jakub Schwan 2015-10-20 08:58:21 UTC
Verified in BPMS 6.2.0 ER4


Note You need to log in before you can comment on or make changes to this bug.