Class BulkUpdateOrphanCheckListener
- java.lang.Object
-
- com.broadleafcommerce.bulk.messaging.BulkUpdateOrphanCheckListener
-
@ConfigurationProperties("broadleaf.bulk.orphan-check") public class BulkUpdateOrphanCheckListener extends Object
A listener that accepts triggered scheduled job events of typeBULK_UPDATE_ORPHAN_CHECK_JOBTYPE
and adjusts theBulkUpdate.status
of any bulk updates that are hanging toBulkUpdateStatus.ERROR
.- Author:
- Samarth Dhruva (samarthd)
-
-
Field Summary
Fields Modifier and Type Field Description static String
BULK_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()
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.protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService
getIdempotentConsumptionService()
protected List<BulkDataRouteSupporting>
getRoutes()
protected com.broadleafcommerce.common.extension.TypeFactory
getTypeFactory()
protected void
handleMessage(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
protected boolean
isSandboxBulkUpdate(BulkUpdate bulkUpdate)
void
listen(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
Queries the data store for all updates withBulkUpdateStatus.REQUESTED
andBulkUpdateStatus.PROCESSING
statuses whoseBulkUpdate.lastUpdated
is beyond an acceptable threshold from the current time.protected void
notifyOfDeleteSandboxRequest(String bulkUpdateId)
protected void
setErrorsAndDeleteSandbox(BulkUpdate hangingUpdate, List<BulkUpdateError> errors)
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.
-
-
-
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.REQUESTED
andBulkUpdateStatus.PROCESSING
statuses whoseBulkUpdate.lastUpdated
is 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()
-
-