cancel
Showing results for 
Search instead for 
Did you mean: 

Task event not firing when calling performing task claim operation

ganeshr
Champ in-the-making
Champ in-the-making
I have a timer boundary event in our business process. Service task will be invoked when timer job fires. In this service task I'm invoking taskservice.claim method to set the assignee for the task. Task assignee is getting changed with userid but the task event(assignment) is not getting fired.

Whereas for the same human task when invoked through rest service to claim the task, task event is getting fired.

Not able to figure out why the events are not getting fired when calling the claim operation from service task. In service task, got the task service using the following statement.
TaskService taskService = execution.getEngineServices().getTaskService();
taskService .claim(taskId,userid);  this statement is getting executed but event not firing.
6 REPLIES 6

jbarrez
Star Contributor
Star Contributor
The event is fired on the lowest possible level

<code>
if(!StringUtils.equals(initialAssignee, assignee)) {
       fireEvent(TaskListener.EVENTNAME_ASSIGNMENT);
       initialAssignee = assignee;
      }
</code>

So you should see it. If not, there is something buggy. Could you create a simple unit test that demonstrates this?

ganeshr
Champ in-the-making
Champ in-the-making
My code has bug. Sorry for that. I have corrected.

prakie
Champ in-the-making
Champ in-the-making
Hi jbarrez,

I believe; having a separate listener event for "Claim" activity  will add more value to any bpm systems.

eg:
events like:
Created / Deleted / Completed - gives the direct meaning that , when the task has been created ,removed  and completed respectively.
Assigned - is tricky,
  – when the task has been assigned? it's like an epic.
  – the task may be assigned / reassigned any no.of times by manager / team leader or by system.
  – it doesn't mean, the user claimed the task and started working on it  immediately.
  – the user may take a n. no.of day to complete the task
As a business user, i want to know;
when the task has been assigned to that user?
When the user actually claimed it?
what's the exact time or  min's that the user spent on that task?
So, The SLA perspective, there's no provision now in the system to provide that " How much time , the user actually spent on the case till Complete"

eg: i cant say that ( completed - assigned ) or duration column in act_hi_task table - will give the exact value.

Please clarify, is anything wrong having a separate task listener event for claim.

PS: How many times it's been assigned/reassigned or claimed - will lead to different issue - that can be handled separately by the new event subscription tables or will figure out the solution later Smiley Happy

Reference Thread:

http://forums.activiti.org/content/history-user-task-claim-time

jbarrez
Star Contributor
Star Contributor
The problem is that 'claim' only makes sense from the candidate group use case. Other tasks will be immediately assigned to an assignee.

I don't see anything wrong with an event listener for it. But from your explanation it seems you are actually looking for the data in the historic tables. In that case, the data is there already: check the claimTime on a historicTaskInstance.

prakie
Champ in-the-making
Champ in-the-making
Well, i believe, historicTaskInstance maintains only the recent claimTime of the Task.

if the user claims, and reassigns to other user, then that user may claim again! is possible to get all the users claimed time from historicTaskInstance.?

i think, providing claim event listener will meet these kinda requirements.

some extent i can get the data from act_hi_comment ["AddUserLink"], which will not satisfy the requirement completely.

jbarrez
Star Contributor
Star Contributor
Ok, i understand now. If you could, can you add a jira for it, so we and you can track it?
(or even better, implement it and create a Pull Request ;-))