Interface ConversationManager
@NonNullByDefault
public interface ConversationManager
The
ConversationManager is responsible for managing the lifecycle and persistence of Conversations.
Implementations should:
- Automatically persist a persistable
Conversationwhenever a message is added or messages are removed. - Emit
ConversationEventimplementations accordingly. - If a conversation has a blank ID, no events will be emitted.
- Author:
- Florian Hotze - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptiondefault ConversationGets a conversation by its identifier.@Nullable ConversationgetConversation(String id, boolean createIfMissing) Gets a conversation by its unique ID.Returns all currently active or stored conversations.voidExplicitly removes a conversation storage.voidsetHistoryLimit(int limit) Sets the maximum number of messages to keep in a conversation history.
-
Method Details
-
getConversation
Gets a conversation by its identifier.If no conversation with that ID exists, create a new conversation.
- Parameters:
id- the unique identifier of the conversation- Returns:
- the conversation
-
getConversation
Gets a conversation by its unique ID.- Parameters:
id- the unique identifier of the conversationcreateIfMissing- whether to create a conversation with the providedidif none exists- Returns:
- the conversation
-
removeConversation
Explicitly removes a conversation storage.- Parameters:
id- the conversation identifier
-
getConversations
Collection<Conversation> getConversations()Returns all currently active or stored conversations.- Returns:
- a collection of all conversations
-
setHistoryLimit
void setHistoryLimit(int limit) Sets the maximum number of messages to keep in a conversation history.- Parameters:
limit- the maximum number of messages
-