Interface NotificationStateRepository
- All Known Subinterfaces:
NotificationStateRepositoryFragment
public interface NotificationStateRepository
Additional interface for repository instances that are capable of interacting with
NotificationState related information on NotificationStateAware domain.- Author:
- Jeff Fischer
-
Method Summary
Modifier and TypeMethodDescriptionfindNotificationReadyMembers(Object lastProcessedNativeId, int pageSize, String messageType, Duration faultThreshold, Class<?> entityType) Find any entity instances that are unacknowledged and qualified for retry for message sending.booleansetFailedNotificationAttempt(Object nativeId, String messageType, int attemptCount, Instant nextAttempt, Class<?> entityType, boolean stopped) Notate a failed message send attempt for a messageType on theNotificationStateof an entity of a particular type.booleansetNotificationAcknowledged(Object nativeId, String messageType, int attemptCount, Class<?> entityType) Establish acknowledged state for aNotificationStateof a particular messageType on an entity of a particular type.
-
Method Details
-
setNotificationAcknowledged
boolean setNotificationAcknowledged(@NonNull Object nativeId, @NonNull String messageType, int attemptCount, @NonNull Class<?> entityType) Establish acknowledged state for aNotificationStateof a particular messageType on an entity of a particular type.- Parameters:
nativeId- The primary key of the entity to updatemessageType- The type of message to ackattemptCount- The current attempt count being madeentityType- The type of the entity containing theNotificationState- Returns:
- Whether or not the update was successful
-
setFailedNotificationAttempt
boolean setFailedNotificationAttempt(@NonNull Object nativeId, @NonNull String messageType, int attemptCount, @NonNull Instant nextAttempt, @NonNull Class<?> entityType, boolean stopped) Notate a failed message send attempt for a messageType on theNotificationStateof an entity of a particular type.- Parameters:
nativeId- The primary key of the entity to updatemessageType- The type of the message that failedattemptCount- the current attempt count being madenextAttempt- The timestamp at which the next attempt should occurentityType- The type of the entity containing theNotificationStatestopped- Whether or not further attempts should be stopped - usually as a result of max attempts being reached.- Returns:
- Whether or not the update was successful
-
findNotificationReadyMembers
@NonNull Stream<NotificationStateAware> findNotificationReadyMembers(@Nullable Object lastProcessedNativeId, int pageSize, @NonNull String messageType, @NonNull Duration faultThreshold, @NonNull Class<?> entityType) Find any entity instances that are unacknowledged and qualified for retry for message sending.- Parameters:
lastProcessedNativeId- The last id that was processed (if any) in a previous batch runpageSize- The max number of records to request and process in this runmessageType- The type of the message that is being targetedfaultThreshold- The amount of time that must have elapsed since theNotificationState.getChangeTimestamp()to be considered qualifiedentityType- The type of the entity containing theNotificationState- Returns:
- A stream of unacknowledged records to process for retry
-