Class MarkQuotesExpiredJobListener
java.lang.Object
com.broadleafcommerce.cart.service.messaging.quote.MarkQuotesExpiredJobListener
Scheduled Job listener that is responsible for reading expired quotes and setting their status to
DefaultQuoteStatuses.EXPIRED.- Author:
- Kyrylo Boiko (kboiko2)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMarkQuotesExpiredJobListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentMessageService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, CartService<com.broadleafcommerce.cart.client.domain.Cart> cartService) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.cart.client.domain.CartActionAuditbuildCartActionAuditForExpiredQuote(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String oldStatus) protected com.broadleafcommerce.data.tracking.core.context.ContextInfobuildContextInfo(com.broadleafcommerce.cart.client.domain.Cart cart) protected com.broadleafcommerce.data.tracking.core.context.ContextInfobuildContextInfoForRead(@NonNull org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) Builds aContextInfoobject forOperationType.READ.protected com.broadleafcommerce.data.tracking.core.context.ContextInfobuildContextInfoForUpdate(@NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfoForRead) Builds aContextInfoobject forOperationType.UPDATEbuildJobDetailsMap(@NonNull com.broadleafcommerce.common.messaging.domain.ScheduledJobRef scheduledJobRef) Build a map from the scheduled job details.protected UpdateCartRequestbuildUpdateCartRequestWithAuditForQuoteExpired(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart) Build therequestto update the cart, adding anaudit.protected intgetBatchSize(@NonNull com.broadleafcommerce.common.messaging.domain.ScheduledJobRef jobRef) Gets the batch size to use when fetching carts.protected CartService<com.broadleafcommerce.cart.client.domain.Cart>protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionServiceprotected Collection<String>getStatusesToExclude(@NonNull Map<String, String> jobDetails) Get the statuses to purge from the job details map or the default value.protected com.broadleafcommerce.common.extension.TypeFactoryvoidlisten(@NonNull org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) protected voidmarkQuotesToExpired(@NonNull List<com.broadleafcommerce.cart.client.domain.Cart> carts, com.broadleafcommerce.data.tracking.core.context.ContextInfo updateContext) Process expired quotes.protected voidprocess(@NonNull org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) Initiates the scheduled job to process expired quotes.
-
Field Details
-
MARK_QUOTE_TO_EXPIRED
- See Also:
-
BATCH_SIZE_FLD
- See Also:
-
DEFAULT_BATCH_SIZE
-
DETAIL_KEY_STATUSES
- See Also:
-
DEFAULT_STATUSES_TO_EXCLUDE
-
-
Constructor Details
-
MarkQuotesExpiredJobListener
public MarkQuotesExpiredJobListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentMessageService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, CartService<com.broadleafcommerce.cart.client.domain.Cart> cartService)
-
-
Method Details
-
listen
@StreamListener("triggeredJobEventMarkQuotesExpired") public void listen(@NonNull @NonNull org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) -
process
protected void process(@NonNull @NonNull org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) Initiates the scheduled job to process expired quotes.- Parameters:
message- theMessagecontaining the scheduled job detail
-
markQuotesToExpired
protected void markQuotesToExpired(@NonNull @NonNull List<com.broadleafcommerce.cart.client.domain.Cart> carts, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo updateContext) Process expired quotes.- Parameters:
carts- carts of typeDefaultCartTypes.QUOTEthat expiredupdateContext- context info for updating quotes.
-
buildJobDetailsMap
protected Map<String,String> buildJobDetailsMap(@NonNull @NonNull com.broadleafcommerce.common.messaging.domain.ScheduledJobRef scheduledJobRef) Build a map from the scheduled job details.- Parameters:
scheduledJobRef- The job being executed.- Returns:
- Map of
ScheduledJobDetailRefname to String value
-
getStatusesToExclude
Get the statuses to purge from the job details map or the default value.- Parameters:
jobDetails- Map ofScheduledJobDetailRef.- Returns:
- Collection of cart statuses that should be purged.
-
buildUpdateCartRequestWithAuditForQuoteExpired
protected UpdateCartRequest buildUpdateCartRequestWithAuditForQuoteExpired(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart) Build therequestto update the cart, adding anaudit.- Parameters:
cart- The cart to be updated.- Returns:
- The update
request.
-
buildContextInfo
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildContextInfo(com.broadleafcommerce.cart.client.domain.Cart cart) -
buildCartActionAuditForExpiredQuote
protected com.broadleafcommerce.cart.client.domain.CartActionAudit buildCartActionAuditForExpiredQuote(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable String oldStatus) -
getBatchSize
protected int getBatchSize(@NonNull @NonNull com.broadleafcommerce.common.messaging.domain.ScheduledJobRef jobRef) Gets the batch size to use when fetching carts. Defaults to 50.- Parameters:
jobRef- theScheduledJobRefcontaining the scheduled job details- Returns:
- the batch size to use when fetching carts
-
buildContextInfoForRead
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildContextInfoForRead(@NonNull @NonNull org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) Builds aContextInfoobject forOperationType.READ.- Parameters:
message- Contains scheduled job details about the context- Returns:
- a
ContextInfoobject forOperationType.READ
-
buildContextInfoForUpdate
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildContextInfoForUpdate(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfoForRead) Builds aContextInfoobject forOperationType.UPDATE- Parameters:
contextInfoForRead- theContextInfowithOperationType.READto build from- Returns:
- a
ContextInfoobject forOperationType.UPDATE
-
getIdempotentMessageService
protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService getIdempotentMessageService() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getCartService
-