Class SessionEventRelay

java.lang.Object
at.aimon.session.web.internal.SessionEventRelay
All Implemented Interfaces:
AutoCloseable, Consumer<at.aimon.core.agent.stream.AgentExecutionEvent>

public final class SessionEventRelay extends Object implements Consumer<at.aimon.core.agent.stream.AgentExecutionEvent>, AutoCloseable
Bridges the session's submitAsync(input, listener) listener channel to (1) the local InProcessEventPublisher and (2) the cross-node ConversationSignalBus for ConversationSignal.SignalKind.EVENT broadcast (design §5.5).

Producer non-blocking invariant: accept(AgentExecutionEvent) runs on the turn execution thread and must never block. The local fan-out goes through InProcessEventPublisher.emit(at.aimon.core.agent.conversation.ConversationId, at.aimon.core.agent.stream.AgentExecutionEvent) (non-blocking offer); the remote fan-out is decoupled via a bounded ArrayBlockingQueue drained by a manager-owned dispatcher thread, so the Redis publish latency can never stall the turn.

On buffer overflow the oldest event is dropped (design §5.5: relay_remote_buffer_drop_total). The remote channel is best-effort — losses are tolerable because a holder-loss sweeper (§6.3 D) eventually emits InterruptedAt + onComplete in the worst case.

  • Field Details

    • RELAY_QUEUE_CAPACITY

      public static final int RELAY_QUEUE_CAPACITY
      Bounded queue capacity per relay — design §5.5 recommended size.
      See Also:
  • Constructor Details

  • Method Details

    • accept

      public void accept(at.aimon.core.agent.stream.AgentExecutionEvent event)
      Specified by:
      accept in interface Consumer<at.aimon.core.agent.stream.AgentExecutionEvent>
    • close

      public void close()
      Synchronously drain remaining events. Called by the manager when the turn ends.
      Specified by:
      close in interface AutoCloseable