Class MessageCompleteEvent

java.lang.Object
ai.redouble.nucleo.events.AbstractJobEvent
ai.redouble.nucleo.events.MessageCompleteEvent
All Implemented Interfaces:
HumanReadable, JobEvent, Serializable

public class MessageCompleteEvent extends AbstractJobEvent implements HumanReadable
Event signaling that a single message exchange in a chat session has completed.

Published by ReactiveThinker after each message iteration, guaranteeing the frontend always receives a terminal signal per message exchange. The frontend uses this to re-enable input, stop typing indicators, and finalize any pending artifacts.

This is distinct from workflow-level events:

  • MessageCompleteEvent - one message exchange is done, conversation continues
  • WorkflowCompleteEvent - the entire chat session or workflow has ended

Published AFTER the last ContentStreamEvent (if any) and AFTER conversation persistence. Content streaming and lifecycle signaling are separate concerns.

Implements JobEvent directly, outside every sealed category, so it reaches only subscribers that ask for it by type or subscribe to everything. A success reads "Message processed" as COMPLETING under the title "Message Complete"; a failure "Message processing failed" as FAILING under "Message Failed", with the error description it was given.

Since:
0.1 (2026-03-14)
Author:
Andrey Santrosyan
See Also:
  • Constructor Details

    • MessageCompleteEvent

      public MessageCompleteEvent(JobSnapshot snapshot, boolean successful)
      Creates a message completion event with the given outcome and no error description.
      Parameters:
      snapshot - the job snapshot
      successful - whether the message was processed successfully
    • MessageCompleteEvent

      public MessageCompleteEvent(JobSnapshot snapshot, boolean successful, String errorMessage)
      Creates a message completion event with optional error.
      Parameters:
      snapshot - the job snapshot
      successful - whether the message was processed successfully
      errorMessage - error description if failed (null for success)
  • Method Details

    • isSuccessful

      public boolean isSuccessful()
    • getErrorMessage

      public String getErrorMessage()
    • msgType

      public MsgType msgType()
    • title

      public String title()
    • jobState

      public JobState jobState()
    • getHumanMessage

      public String getHumanMessage()
      Description copied from interface: HumanReadable
      Returns a plain-text message suitable for display to end users.
      Specified by:
      getHumanMessage in interface HumanReadable
      Returns:
      user-friendly message