Class BulkUpdateOrphanCheckListener
- java.lang.Object
-
- com.broadleafcommerce.bulk.messaging.BulkUpdateOrphanCheckListener
-
@ConfigurationProperties("broadleaf.bulk.orphan-check") public class BulkUpdateOrphanCheckListener extends ObjectA listener that accepts triggered scheduled job events of typeBULK_UPDATE_ORPHAN_CHECK_JOBTYPEand adjusts theBulkUpdate.statusof any bulk updates that are hanging toBulkUpdateStatus.ERROR.- Author:
- Samarth Dhruva (samarthd)
-
-
Field Summary
Fields Modifier and Type Field Description static StringBULK_UPDATE_ORPHAN_CHECK_JOBTYPE
-
Constructor Summary
Constructors Constructor Description BulkUpdateOrphanCheckListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, BulkUpdateService<BulkUpdate> bulkUpdateService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, List<BulkDataRouteSupporting> routes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BulkUpdateService<BulkUpdate>getBulkUpdateService()DurationgetHangingCutoff()This value represents the amount of time that a bulk update is allowed to be idle (in a state of "REQUESTED" or "PROCESSING") before it is considered hanging and set to an error state.protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionServicegetIdempotentConsumptionService()protected List<BulkDataRouteSupporting>getRoutes()protected com.broadleafcommerce.common.extension.TypeFactorygetTypeFactory()protected voidhandleMessage(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)protected booleanisSandboxBulkUpdate(BulkUpdate bulkUpdate)voidlisten(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)Queries the data store for all updates withBulkUpdateStatus.REQUESTEDandBulkUpdateStatus.PROCESSINGstatuses whoseBulkUpdate.lastUpdatedis beyond an acceptable threshold from the current time.protected voidnotifyOfDeleteSandboxRequest(String bulkUpdateId)protected voidsetErrorsAndDeleteSandbox(BulkUpdate hangingUpdate, List<BulkUpdateError> errors)voidsetHangingCutoff(Duration hangingCutoff)This value represents the amount of time that a bulk update is allowed to be idle (in a state of "REQUESTED" or "PROCESSING") before it is considered hanging and set to an error state.
-
-
-
Field Detail
-
BULK_UPDATE_ORPHAN_CHECK_JOBTYPE
public static final String BULK_UPDATE_ORPHAN_CHECK_JOBTYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BulkUpdateOrphanCheckListener
public BulkUpdateOrphanCheckListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, BulkUpdateService<BulkUpdate> bulkUpdateService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, List<BulkDataRouteSupporting> routes)
-
-
Method Detail
-
listen
@StreamListener("triggeredJobEventInputOrphanBulk") public void listen(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)Queries the data store for all updates withBulkUpdateStatus.REQUESTEDandBulkUpdateStatus.PROCESSINGstatuses whoseBulkUpdate.lastUpdatedis beyond an acceptable threshold from the current time. Each of these records is locked and updated to have anBulkUpdateStatus.ERROR.- Parameters:
message- a scheduled job trigger event - will only be handled if it has typeBULK_UPDATE_ORPHAN_CHECK_JOBTYPE
-
handleMessage
protected void handleMessage(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
-
setErrorsAndDeleteSandbox
protected void setErrorsAndDeleteSandbox(BulkUpdate hangingUpdate, List<BulkUpdateError> errors)
-
notifyOfDeleteSandboxRequest
protected void notifyOfDeleteSandboxRequest(String bulkUpdateId)
-
isSandboxBulkUpdate
protected boolean isSandboxBulkUpdate(@NonNull BulkUpdate bulkUpdate)
-
getIdempotentConsumptionService
protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService getIdempotentConsumptionService()
-
getHangingCutoff
public Duration getHangingCutoff()
This value represents the amount of time that a bulk update is allowed to be idle (in a state of "REQUESTED" or "PROCESSING") before it is considered hanging and set to an error state.
-
setHangingCutoff
public void setHangingCutoff(Duration hangingCutoff)
This value represents the amount of time that a bulk update is allowed to be idle (in a state of "REQUESTED" or "PROCESSING") before it is considered hanging and set to an error state.
-
getBulkUpdateService
@NonNull protected BulkUpdateService<BulkUpdate> getBulkUpdateService()
-
getTypeFactory
@NonNull protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
getRoutes
@NonNull protected List<BulkDataRouteSupporting> getRoutes()
-
-