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 type BULK_UPDATE_ORPHAN_CHECK_JOBTYPE and adjusts the BulkUpdate.status of any bulk updates that are hanging to BulkUpdateStatus.ERROR.
Author:
Samarth Dhruva (samarthd)
  • Field Details

  • Constructor Details

    • BulkUpdateOrphanCheckListener

      public BulkUpdateOrphanCheckListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, BulkUpdateService<BulkUpdate> bulkUpdateService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, List<BulkDataRouteSupporting> routes)
  • Method Details

    • listen

      @StreamListener("triggeredJobEventInputOrphanBulk") public void listen(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
      Queries the data store for all updates with BulkUpdateStatus.REQUESTED and BulkUpdateStatus.PROCESSING statuses whose BulkUpdate.lastUpdated is beyond an acceptable threshold from the current time. Each of these records is locked and updated to have an BulkUpdateStatus.ERROR.
      Parameters:
      message - a scheduled job trigger event - will only be handled if it has type BULK_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()