AnsweredAssumed Answered

Event thrown on entity not found.

Question asked by mhanrahan on Nov 25, 2016
Latest reply on Dec 16, 2016 by gdharley
Hi,

In our system, we are hooking into the Activiti event system using a ActivitiEventHandler, detecting an ENTITY_CREATED for when a Task is created. We then pass a lightweight message containing the Task ID to a different part of our system (outside Activiti), which then will try to retrieve the full entity via either the REST API or from the TaskService (which amounts to the same thing).

The issue we're facing lies in the fact that once we have received the ENTITY_CREATED event and are trying to retrieve the Task, we get task not found exceptions.

I found this activiti forum topic https://forums.activiti.org/content/problem-using-event-handlers that describes the issue, that the TaskService loads from the database, and the task might not be persisted in the database at the time of the ENTITY_CREATED event.

So my questions are:
1. Am I missing something with regards to querying a task from outside of Activiti to get the 'current' versus the 'database' version of the task?
2. What was the rationale behind firing an event before it could be queried?
3. And is there any chance of changing this behaviour in the future?
4. If none of the above is possible, how would you suggest that I proceed?

Regards,
Michael

Outcomes