Class ExportOrphanCheckListener
- java.lang.Object
-
- com.broadleafcommerce.common.dataexport.messaging.ExportOrphanCheckListener
-
@ConfigurationProperties("broadleaf.export.orphan-check") public class ExportOrphanCheckListener extends Object
A listener that accepts triggered scheduled job events of typeEXPORT_ORPHAN_CHECK_JOBTYPE
and adjusts theExport.status
of any exports that are hanging toExportStatus.ERROR
.- Author:
- Samarth Dhruva (samarthd)
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXPORT_ORPHAN_CHECK_JOBTYPE
-
Constructor Summary
Constructors Constructor Description ExportOrphanCheckListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, List<ExportDataRouteSupporting> dataRoutes, ExportService<Export> exportService, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<ExportDataRouteSupporting>
getDataRoutes()
protected ExportService<Export>
getExportService()
protected String
getHANGING_ERROR_MESSAGE()
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.protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService
getIdempotentConsumptionService()
protected com.broadleafcommerce.common.extension.TypeFactory
getTypeFactory()
protected void
handleMessage(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
void
listen(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
Queries the data store for all exports withExportStatus.REQUESTED
andExportStatus.PROCESSING
statuses whoseExport.lastUpdated
is beyond an acceptable threshold from the current time.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.protected void
setHangingError(Export export)
-
-
-
Field Detail
-
EXPORT_ORPHAN_CHECK_JOBTYPE
public static final String EXPORT_ORPHAN_CHECK_JOBTYPE
- See Also:
- Constant Field Values
-
-
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 withExportStatus.REQUESTED
andExportStatus.PROCESSING
statuses whoseExport.lastUpdated
is beyond an acceptable threshold from the current time. Each of these records is updated to have anExportStatus.ERROR
.- Parameters:
scheduledJobRef
- a scheduled job trigger event - will only be handled if it has typeEXPORT_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.
-
getDataRoutes
@NonNull protected List<ExportDataRouteSupporting> getDataRoutes()
-
getExportService
@NonNull protected ExportService<Export> getExportService()
-
getTypeFactory
@NonNull protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
getHANGING_ERROR_MESSAGE
@NonNull protected String getHANGING_ERROR_MESSAGE()
-
-