Kogito Listener vs Data Index - Sync

56 views
Skip to first unread message

Pawan Saha

unread,
Mar 18, 2025, 6:15:22 PM3/18/25
to Kogito development mailing list

Hi Team,

I'm working on a Kogito-based workflow and using an afterVariableChanged listener to react to process variable changes. Inside this listener, I immediately query the Data Index GraphQL API (userTaskInstances) to check the updated state of the process instance.

The Issue:

Inside the listener, my GraphQL query returns the previous state.
For example:

  • I expect the user task to be in InProgress, but it still shows as Assigned when queried from the listener.
  • However, at the same moment, if I run the exact same query externally (e.g., via Postman), I see the correct and latest state (InProgress).
Questions:
  1. Is the afterVariableChanged listener firing before the process instance's transaction is committed?
  2. If so, does this mean I'm querying the Data Index inside an uncommitted transaction from the Kogito runtime?
  3. Is there a recommended lifecycle event or listener I can use to react after the transaction is complete?
Regards,
Pawan

Pawan Saha

unread,
Mar 19, 2025, 2:24:40 AM3/19/25
to Kogito development mailing list

Rephrasing my question. Kindly ignore my previous email.  

Hi Team,

I’m working on a Kogito-based workflow and using the afterVariableChanged listener to respond to process variable updates. Within this listener, I immediately query the Data Index GraphQL API (UserTaskInstances) to check the latest state of the process instance.

The issue:

Inside the afterVariableChanged listener, my GraphQL query returns the last outputs as null in the latest input under UserTaskInstances.
However, if I run the exact same query externally (e.g., via Postman) at the same moment, I can see the expected outputs populated in the latest input under userTaskInstances.

Questions:

  1. Is the afterVariableChanged listener triggered before the process instance transaction is fully committed?
  2. If so, does this mean that querying the Data Index from within the listener occurs while the Kogito runtime transaction is still uncommitted?
  3. Is there a listener in Kogito that triggers after the transaction is completed and the data is fully propagated to the Data Index?

I have also tried using the afterProcessCompleted listener, but I am still seeing the same behavior.

Appreciate your insights and guidance on this.

Regards,

Pawan

Pawan Saha

unread,
Mar 19, 2025, 2:45:43 AM3/19/25
to Kogito development mailing list
Please find attached the screenshot for better understanding of my query.
In the notepad, I am showing the result of the same GraphQL query, where the outputs field appears as null. However, when I execute the exact same GraphQL query from Postman, it returns a result where "outputs" is populated (not null).  
Screenshot 2025-03-19 120834.png

pawan saha

unread,
Mar 27, 2025, 5:39:03 PM3/27/25
to kogito-de...@googlegroups.com
Hi Alex,
Can you please suggest how to handle the situation below, or if we can use any listener available?

Scenario: I’m working on a Kogito-based workflow and using the afterVariableChanged listener to respond to process variable updates. Within this listener, I immediately query the Data Index GraphQL API (UserTaskInstances) to check the latest state of the process instance.

The issue: Inside the afterVariableChanged listener, my GraphQL query returns the last outputs as null in the latest input under UserTaskInstances.However, if I run the exact same query externally (e.g., via Postman) at the same moment, I can see the expected outputs populated in the latest input under userTaskInstances.

Please find attached the screenshot for better understanding of my query.
In the notepad, I am showing the result of the same GraphQL query, where the outputs field appears as null. However, when I execute the exact same GraphQL query from Postman, it returns a result where "outputs" is populated (not null).  
Screenshot 2025-03-19 120834.png

Regards,
Pawan

--
You received this message because you are subscribed to the Google Groups "Kogito development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kogito-developm...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/kogito-development/d25afecc-96fa-4bfa-9f6e-5effffd9a30an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages