Interface ChatMessageService
- All Known Implementing Classes:
ChatMessageServiceImpl
public interface ChatMessageService
-
Method Summary
Modifier and TypeMethodDescriptionvoidclearUserNotifications(UUID userId) Clear notifications for a user (delete notification messages for the user)org.springframework.data.domain.Page<OutputChatMessageDto> getConversationMessages(Conversation conversation, org.springframework.data.domain.Pageable pageable) Get a page of chat messages for the conversationgetConversationMessages(UUID conversationId) Get messages for a specific conversationgetConversationMessageSummary(UUID userId, List<Conversation> conversations) Get message summary for each conversation for the conversationsgetOutputChatMessageDto(ChatMessage chatMessage, boolean loadUserProfiles) Maps the chat message entity to output dtogetUserNotifications(UUID userId) Get notifications for a specific user (messages where receiverId matches userId)voidhandleChatMessage(ChatMessage chatMessage) Handles chat messages from the chat queuevoidhandleUserNotification(ChatMessage chatMessage) Handles user notification messages from queueintmarkConversationAsRead(Conversation conversation, UUID userId, Instant readAt) Mark all unread messages in a conversation as read by a specific user.intmarkConversationBulkMessagesAsRead(Conversation conversation, UUID userId, Instant readAt, Set<UUID> messageIds) Mark all unread messages in a conversation as read by a specific user for the passed ids.intmarkConversationMessagesUptoCreatedAtAsRead(Conversation conversation, UUID userId, Instant readAt, Instant uptoCreatedAt) Mark all unread messages in a conversation as read by a specific user for the messages created at or before.org.springframework.data.domain.Page<OutputChatMessageDto> searchMessages(UUID userId, String searchTerm, org.springframework.data.domain.Pageable pageable) Get a page of chat messages matching the search term
-
Method Details
-
handleChatMessage
Handles chat messages from the chat queue -
handleUserNotification
Handles user notification messages from queue -
getConversationMessages
Get messages for a specific conversation -
getConversationMessageSummary
Map<UUID,OutputConversationMessageSummaryDto> getConversationMessageSummary(UUID userId, List<Conversation> conversations) Get message summary for each conversation for the conversations -
getConversationMessages
org.springframework.data.domain.Page<OutputChatMessageDto> getConversationMessages(Conversation conversation, org.springframework.data.domain.Pageable pageable) Get a page of chat messages for the conversation -
markConversationAsRead
Mark all unread messages in a conversation as read by a specific user. -
markConversationMessagesUptoCreatedAtAsRead
int markConversationMessagesUptoCreatedAtAsRead(Conversation conversation, UUID userId, Instant readAt, Instant uptoCreatedAt) Mark all unread messages in a conversation as read by a specific user for the messages created at or before. -
markConversationBulkMessagesAsRead
int markConversationBulkMessagesAsRead(Conversation conversation, UUID userId, Instant readAt, Set<UUID> messageIds) Mark all unread messages in a conversation as read by a specific user for the passed ids. -
getUserNotifications
Get notifications for a specific user (messages where receiverId matches userId) -
clearUserNotifications
Clear notifications for a user (delete notification messages for the user) -
searchMessages
org.springframework.data.domain.Page<OutputChatMessageDto> searchMessages(UUID userId, String searchTerm, org.springframework.data.domain.Pageable pageable) Get a page of chat messages matching the search term- Parameters:
userId- the user IDsearchTerm- free-text termpageable- the pageable containing requested paging and sorting information- Returns:
- list of matching messages
-
getOutputChatMessageDto
OutputChatMessageDto getOutputChatMessageDto(@NonNull ChatMessage chatMessage, boolean loadUserProfiles) Maps the chat message entity to output dto- Parameters:
chatMessage- the chat message entityloadUserProfiles- flag to indicate if user profiles should be loaded to fetch chat user details e.g. sender- Returns:
- the output chat message dto
-