Class DetachedNotificationStateRepository

java.lang.Object
com.broadleafcommerce.data.tracking.jpa.messaging.DetachedNotificationStateRepository
All Implemented Interfaces:
com.broadleafcommerce.common.extension.DomainTypeAware, com.broadleafcommerce.common.messaging.notification.NotificationStateRepository

public class DetachedNotificationStateRepository extends Object implements com.broadleafcommerce.common.messaging.notification.NotificationStateRepository, com.broadleafcommerce.common.extension.DomainTypeAware
Repository designated for direct interaction with NotificationState instances without the use of an explicit JPA NotificationStateAware domain. This represents the primary data persistence for message send durability during the detached flow.
See Also:
  • DetachedDurableMessageSender
  • Constructor Details

    • DetachedNotificationStateRepository

      public DetachedNotificationStateRepository(NotificationStateValueUpdater delegate, com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper helper)
  • Method Details

    • init

      @Transactional(propagation=REQUIRES_NEW) public JpaNotificationState init(Object message, String messageType, String id, Map<String,String> additionalHeaders)
      Setup a NotificationState with an un-acked status and populate the message value.
      Parameters:
      message - The message POJO to be converted to JSON and stored in NotificationState.setMessageValue(String).
      messageType - The messageType to be saved on the NotificationState.setName(String). Corresponds to DurableProducer.name().
      id - Idempotent, unique identifier for the message. See DefaultDetachedDurableMessageSender#send(Object, String, String).
      Returns:
      The persisted instance of the NotificationState
    • setNotificationAcknowledged

      public boolean setNotificationAcknowledged(@NonNull Object nativeId, @NonNull String messageType, int attemptCount, @NonNull Class<?> entityType)
      Specified by:
      setNotificationAcknowledged in interface com.broadleafcommerce.common.messaging.notification.NotificationStateRepository
    • setFailedNotificationAttempt

      public boolean setFailedNotificationAttempt(@NonNull Object nativeId, @NonNull String messageType, int attemptCount, @NonNull Instant nextAttempt, @NonNull Class<?> entityType, boolean stopped)
      Specified by:
      setFailedNotificationAttempt in interface com.broadleafcommerce.common.messaging.notification.NotificationStateRepository
    • findNotificationReadyMembers

      @NonNull public Stream<com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware> findNotificationReadyMembers(@Nullable Object lastProcessedNativeId, int pageSize, @NonNull String messageType, @NonNull Duration faultThreshold, @NonNull Class<?> entityType)
      Specified by:
      findNotificationReadyMembers in interface com.broadleafcommerce.common.messaging.notification.NotificationStateRepository
    • findNotificationMembers

      @NonNull public List<JpaNotificationState> findNotificationMembers(@NonNull Class<?> entityType, @NonNull String id)
      Similar behavior and contract as that described by NotificationStateValueUpdater.findNotificationMembers(Class, String)
    • getDomainType

      public Class<?> getDomainType()
      Specified by:
      getDomainType in interface com.broadleafcommerce.common.extension.DomainTypeAware
    • getEntityManager

      public jakarta.persistence.EntityManager getEntityManager()