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
Created attachment 1007164 [details] maven project
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?
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.
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
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
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.
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...
fixed on master jbpm master: https://github.com/droolsjbpm/jbpm/commit/3ea7e2c42151d6c00b7fb7795d98ba8138211055
*** Bug 1271904 has been marked as a duplicate of this bug. ***
Verified in BPMS 6.2.0 ER4