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 Details

    • setNotificationAcknowledged

      boolean setNotificationAcknowledged(@NonNull Object nativeId, @NonNull String messageType, int attemptCount, @NonNull Class<?> entityType)
      Establish acknowledged state for a NotificationState of a particular messageType on an entity of a particular type.
      Parameters:
      nativeId - The primary key of the entity to update
      messageType - The type of message to ack
      attemptCount - The current attempt count being made
      entityType - The type of the entity containing the NotificationState
      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 the NotificationState of an entity of a particular type.
      Parameters:
      nativeId - The primary key of the entity to update
      messageType - The type of the message that failed
      attemptCount - the current attempt count being made
      nextAttempt - The timestamp at which the next attempt should occur
      entityType - The type of the entity containing the NotificationState
      stopped - 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 run
      pageSize - The max number of records to request and process in this run
      messageType - The type of the message that is being targeted
      faultThreshold - The amount of time that must have elapsed since the NotificationState.getChangeTimestamp() to be considered qualified
      entityType - The type of the entity containing the NotificationState
      Returns:
      A stream of unacknowledged records to process for retry