Class InMemoryConversationInbox
java.lang.Object
at.aimon.session.web.spi.inmemory.InMemoryConversationInbox
- All Implemented Interfaces:
ConversationInbox
Single-process
ConversationInbox backed by per-conversation lock-protected lists.
Implementation goal is correctness over throughput: each deliver/collect acquires the
conversation's monitor so priority-then-FIFO ordering and atomic batch removal are trivially preserved. Sequence
numbers issued from a single AtomicLong provide stable FIFO ordering across deliveries.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncollect(at.aimon.core.agent.conversation.ConversationId id, at.aimon.core.agent.queue.QueuedInputPriority maxPriority) Atomically removes and returns up to all messages with priority ≤maxPriorityforid, in priority-then-FIFO order.deliver(InboundMessage message) Appendmessageto its conversation's inbox.booleanisEmpty(at.aimon.core.agent.conversation.ConversationId id) Quick check without dequeuing.voidpurge(at.aimon.core.agent.conversation.ConversationId id) Drop every pending message forid(called fromreleaseConversation).
-
Constructor Details
-
InMemoryConversationInbox
public InMemoryConversationInbox()
-
-
Method Details
-
deliver
Description copied from interface:ConversationInboxAppendmessageto its conversation's inbox.- Specified by:
deliverin interfaceConversationInbox- Parameters:
message- the envelope (must not be null). The implementation typically assigns theInboundMessageId— themessage.idfield on entry is unused; the returned id is authoritative.- Returns:
- the stable id assigned by this implementation
-
collect
public List<InboundMessage> collect(at.aimon.core.agent.conversation.ConversationId id, at.aimon.core.agent.queue.QueuedInputPriority maxPriority) Description copied from interface:ConversationInboxAtomically removes and returns up to all messages with priority ≤maxPriorityforid, in priority-then-FIFO order.- Specified by:
collectin interfaceConversationInbox- Parameters:
id- the conversation (must not be null)maxPriority- inclusive ceiling —NOWreturns only NOW,LATERreturns all tiers- Returns:
- collected messages (never null; may be empty)
-
isEmpty
public boolean isEmpty(at.aimon.core.agent.conversation.ConversationId id) Description copied from interface:ConversationInboxQuick check without dequeuing.- Specified by:
isEmptyin interfaceConversationInbox- Parameters:
id- the conversation (must not be null)- Returns:
truewhen the inbox has zero pending messages forid
-
purge
public void purge(at.aimon.core.agent.conversation.ConversationId id) Description copied from interface:ConversationInboxDrop every pending message forid(called fromreleaseConversation).- Specified by:
purgein interfaceConversationInbox- Parameters:
id- the conversation (must not be null)
-