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 Details

  • 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 a ImportStatus.REQUESTED status whose Import.lastUpdated is beyond an acceptable threshold from the current time. Each of these records is locked and updated to have an ImportStatus.FAILED.
      Parameters:
      message - a message containing a scheduled job trigger event - will only be handled if it has type IMPORT_ORPHAN_CHECK_JOBTYPE
    • processMessage

      protected void processMessage(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
    • setHanging

      protected void setHanging(Import anImport, Instant threshold, String errorMessage)
    • notifyOfDeleteSandboxRequest

      protected void notifyOfDeleteSandboxRequest(String importId)
    • getIdempotentConsumptionService

      protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService getIdempotentConsumptionService()
    • getHangingCutoff

      public Duration 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

      public 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.
    • getImportService

      protected ImportService<Import> getImportService()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()