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 Summary
ConstructorDescriptionDetachedNotificationStateRepository
(NotificationStateValueUpdater delegate, com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper helper) -
Method Summary
Modifier and TypeMethodDescriptionfindNotificationMembers
(Class<?> entityType, String id) Similar behavior and contract as that described byNotificationStateValueUpdater.findNotificationMembers(Class, String)
Stream<com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware>
findNotificationReadyMembers
(Object lastProcessedNativeId, int pageSize, String messageType, Duration faultThreshold, Class<?> entityType) Class<?>
javax.persistence.EntityManager
Setup aNotificationState
with an un-acked status and populate the message value.boolean
setFailedNotificationAttempt
(Object nativeId, String messageType, int attemptCount, Instant nextAttempt, Class<?> entityType, boolean stopped) boolean
setNotificationAcknowledged
(Object nativeId, String messageType, int attemptCount, Class<?> entityType)
-
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 aNotificationState
with an un-acked status and populate the message value.- Parameters:
message
- The message POJO to be converted to JSON and stored inNotificationState.setMessageValue(String)
.messageType
- The messageType to be saved on theNotificationState.setName(String)
. Corresponds toDurableProducer.name()
.id
- Idempotent, unique identifier for the message. SeeDefaultDetachedDurableMessageSender#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 interfacecom.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 interfacecom.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 interfacecom.broadleafcommerce.common.messaging.notification.NotificationStateRepository
-
findNotificationMembers
@NonNull public List<JpaNotificationState> findNotificationMembers(@NonNull Class<?> entityType, @NonNull String id) Similar behavior and contract as that described byNotificationStateValueUpdater.findNotificationMembers(Class, String)
-
getDomainType
- Specified by:
getDomainType
in interfacecom.broadleafcommerce.common.extension.DomainTypeAware
-
getEntityManager
public javax.persistence.EntityManager getEntityManager()
-