Package at.aimon.session.web.internal
Class InProcessEventPublisher
java.lang.Object
at.aimon.session.web.internal.InProcessEventPublisher
- All Implemented Interfaces:
AutoCloseable
Backing publisher for
WebAgentSessionManager.events(ConversationId).
Maintains one SubmissionPublisher per ConversationId, lazily created on first emit or subscribe.
Multi-subscriber: every Flow.Subscriber attached to a publisher receives the same event stream.
Producer non-blocking invariant (design §5.5.1): emit(ConversationId, AgentExecutionEvent) must never
block the turn thread. We use SubmissionPublisher.offer(item, 0L, NANOS, onDrop) so demand-saturated
subscribers cause oldest events to be dropped rather than parking the producer.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidcomplete(at.aimon.core.agent.conversation.ConversationId id) EmitonComplete()on the publisher foridand remove it from the map.voidemit(at.aimon.core.agent.conversation.ConversationId id, at.aimon.core.agent.stream.AgentExecutionEvent event) Pusheventto subscribers ofid's publisher (lazy-creating one if needed).Flow.Publisher<at.aimon.core.agent.stream.AgentExecutionEvent> publisherFor(at.aimon.core.agent.conversation.ConversationId id) Returns the publisher forid, creating one on first use.
-
Constructor Details
-
InProcessEventPublisher
public InProcessEventPublisher()
-
-
Method Details
-
publisherFor
public Flow.Publisher<at.aimon.core.agent.stream.AgentExecutionEvent> publisherFor(at.aimon.core.agent.conversation.ConversationId id) Returns the publisher forid, creating one on first use.- Parameters:
id- the conversation (must not be null)- Returns:
- a non-null publisher
-
emit
public void emit(at.aimon.core.agent.conversation.ConversationId id, at.aimon.core.agent.stream.AgentExecutionEvent event) Pusheventto subscribers ofid's publisher (lazy-creating one if needed).Slow subscribers cause the oldest queued event to be dropped — never block the producer.
- Parameters:
id- the conversation (must not be null)event- the event (must not be null)
-
complete
public void complete(at.aimon.core.agent.conversation.ConversationId id) EmitonComplete()on the publisher foridand remove it from the map. Subsequentemit/publisherForfor the same id transparently allocate a fresh publisher.- Parameters:
id- the conversation (must not be null)
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-