Class ExportOrphanCheckListener


  • @ConfigurationProperties("broadleaf.export.orphan-check")
    public class ExportOrphanCheckListener
    extends Object
    A listener that accepts triggered scheduled job events of type EXPORT_ORPHAN_CHECK_JOBTYPE and adjusts the Export.status of any exports that are hanging to ExportStatus.ERROR.
    Author:
    Samarth Dhruva (samarthd)
    • Constructor Detail

      • ExportOrphanCheckListener

        public ExportOrphanCheckListener​(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService,
                                         @NonNull
                                         List<ExportDataRouteSupporting> dataRoutes,
                                         @NonNull
                                         ExportService<Export> exportService,
                                         @NonNull
                                         com.broadleafcommerce.common.extension.TypeFactory typeFactory)
    • Method Detail

      • listen

        @StreamListener("triggeredJobEventInputOrphanExport")
        public void listen​(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
        Queries the data store for all exports with ExportStatus.REQUESTED and ExportStatus.PROCESSING statuses whose Export.lastUpdated is beyond an acceptable threshold from the current time. Each of these records is updated to have an ExportStatus.ERROR.
        Parameters:
        scheduledJobRef - a scheduled job trigger event - will only be handled if it has type EXPORT_ORPHAN_CHECK_JOBTYPE
      • handleMessage

        protected void handleMessage​(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
      • setHangingError

        protected void setHangingError​(Export export)
      • getIdempotentConsumptionService

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

        public Duration getHangingCutoff()
        This value represents the amount of time that an export 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 an export is allowed to be idle (in a state of "REQUESTED" or "PROCESSING") before it is considered hanging and set to an error state.
      • getTypeFactory

        @NonNull
        protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
      • getHANGING_ERROR_MESSAGE

        @NonNull
        protected String getHANGING_ERROR_MESSAGE()