Class ImportOrphanCheckListener
java.lang.Object
com.broadleafcommerce.dataimport.messaging.ImportOrphanCheckListener
@DataRouteByKey("import")
@ConfigurationProperties("broadleaf.import.orphan-check")
public class ImportOrphanCheckListener
extends Object
A listener that accepts triggered scheduled job events of type
IMPORT_ORPHAN_CHECK_JOBTYPE
and adjusts the Import.status
of any imports that
are hanging to ImportStatus.FAILED
.- Author:
- Samarth Dhruva (samarthd)
-
Field Summary
-
Constructor Summary
ConstructorDescriptionImportOrphanCheckListener
(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, ImportService<Import> importService, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionThis value represents the amount of time that an import is allowed to be idle (in a state of "REQUESTED") before it is considered hanging and set to an error state.protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService
protected ImportService<Import>
protected com.broadleafcommerce.common.extension.TypeFactory
void
listen
(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) Queries the data store for all imports with aImportStatus.REQUESTED
status whoseImport.lastUpdated
is beyond an acceptable threshold from the current time.protected void
notifyOfDeleteSandboxRequest
(String importId) protected void
processMessage
(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) protected void
setHanging
(Import anImport, Instant threshold, String errorMessage) void
setHangingCutoff
(Duration hangingCutoff) This value represents the amount of time that an import is allowed to be idle (in a state of "REQUESTED") before it is considered hanging and set to an error state.
-
Field Details
-
IMPORT_ORPHAN_CHECK_JOBTYPE
- See Also:
-
-
Constructor Details
-
ImportOrphanCheckListener
public ImportOrphanCheckListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, ImportService<Import> importService, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
listen
@StreamListener("triggeredJobEventInputOrphanImport") public void listen(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) Queries the data store for all imports with aImportStatus.REQUESTED
status whoseImport.lastUpdated
is beyond an acceptable threshold from the current time. Each of these records is locked and updated to have anImportStatus.FAILED
.- Parameters:
message
- a message containing a scheduled job trigger event - will only be handled if it has typeIMPORT_ORPHAN_CHECK_JOBTYPE
-
processMessage
protected void processMessage(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) -
setHanging
-
notifyOfDeleteSandboxRequest
-
getIdempotentConsumptionService
protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService getIdempotentConsumptionService() -
getHangingCutoff
This value represents the amount of time that an import is allowed to be idle (in a state of "REQUESTED") before it is considered hanging and set to an error state. -
setHangingCutoff
This value represents the amount of time that an import is allowed to be idle (in a state of "REQUESTED") before it is considered hanging and set to an error state. -
getImportService
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-