Class FormStateStore

java.lang.Object
com.axelor.ai.procedure.FormStateStore

@Singleton public class FormStateStore extends Object
Where a procedure run paused in a chat is kept until its owner answers: on the generic cache (local, or distributed across nodes), under form:<chatId>#<toolCallId>, as JSON, so whichever node receives the answer carries on.

An entry is claimed once, under the cache's per-key lock — the same claim the chat stream keeps for client tools — so exactly one answer carries a paused run on, and only its owner's: a pending entry becomes claimed, a claimed one resolved. A run that pauses again is stored afresh, pending, under a new question id: an answer claims only the question it was given for, so a late or repeated answer to an earlier question of the same call cannot carry on a later one. An entry nobody answers expires after a day; answering it then is refused, and the procedure must be run again.

  • Method Details

    • put

      public String put(String chatId, String toolCallId, String owner, ProcedureRunner.Paused paused)
      Keeps a paused run for its owner, pending an answer; replaces any earlier pause of the call.
      Returns:
      the id of the question it waits on, for the answer to hand back
    • claim

      public ProcedureRunner.Paused claim(String chatId, String toolCallId, String owner, String question)
      Claims the paused run to carry it on: only a pending entry of owner, waiting on question, is claimable, once.
      Returns:
      the run, or null when there is none to claim — expired, already answered, another user's, or waiting on another question
    • resolve

      public void resolve(String chatId, String toolCallId)
      Marks a claimed run as done with, so it can never be carried on again.