Class MarkQuotesExpiredJobListener

java.lang.Object
com.broadleafcommerce.cart.service.messaging.quote.MarkQuotesExpiredJobListener

@DataRouteByKey("cart") public class MarkQuotesExpiredJobListener extends Object
Scheduled Job listener that is responsible for reading expired quotes and setting their status to DefaultQuoteStatuses.EXPIRED.
Author:
Kyrylo Boiko (kboiko2)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final Integer
     
    static final Set<String>
     
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    MarkQuotesExpiredJobListener(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 Type
    Method
    Description
    protected com.broadleafcommerce.cart.client.domain.CartActionAudit
    buildCartActionAuditForExpiredQuote(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String oldStatus)
     
    protected com.broadleafcommerce.data.tracking.core.context.ContextInfo
    buildContextInfo(com.broadleafcommerce.cart.client.domain.Cart cart)
     
    protected com.broadleafcommerce.data.tracking.core.context.ContextInfo
    buildContextInfoForRead(@NonNull org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
    Builds a ContextInfo object for OperationType.READ.
    protected com.broadleafcommerce.data.tracking.core.context.ContextInfo
    buildContextInfoForUpdate(@NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfoForRead)
    Builds a ContextInfo object for OperationType.UPDATE
    protected Map<String,String>
    buildJobDetailsMap(@NonNull com.broadleafcommerce.common.messaging.domain.ScheduledJobRef scheduledJobRef)
    Build a map from the scheduled job details.
    buildUpdateCartRequestWithAuditForQuoteExpired(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
    Build the request to update the cart, adding an audit.
    protected int
    getBatchSize(@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.IdempotentMessageConsumptionService
     
    protected 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.TypeFactory
     
    void
    listen(@NonNull org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
     
    protected void
    markQuotesToExpired(@NonNull List<com.broadleafcommerce.cart.client.domain.Cart> carts, com.broadleafcommerce.data.tracking.core.context.ContextInfo updateContext)
    Process expired quotes.
    protected void
    process(@NonNull org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
    Initiates the scheduled job to process expired quotes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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 - the Message containing 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 type DefaultCartTypes.QUOTE that expired
      updateContext - 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 ScheduledJobDetailRef name to String value
    • getStatusesToExclude

      protected Collection<String> getStatusesToExclude(@NonNull @NonNull Map<String,String> jobDetails)
      Get the statuses to purge from the job details map or the default value.
      Parameters:
      jobDetails - Map of ScheduledJobDetailRef.
      Returns:
      Collection of cart statuses that should be purged.
    • buildUpdateCartRequestWithAuditForQuoteExpired

      protected UpdateCartRequest buildUpdateCartRequestWithAuditForQuoteExpired(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
      Build the request to update the cart, adding an audit.
      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 - the ScheduledJobRef containing 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 a ContextInfo object for OperationType.READ.
      Parameters:
      message - Contains scheduled job details about the context
      Returns:
      a ContextInfo object for OperationType.READ
    • buildContextInfoForUpdate

      protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildContextInfoForUpdate(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfoForRead)
      Builds a ContextInfo object for OperationType.UPDATE
      Parameters:
      contextInfoForRead - the ContextInfo with OperationType.READ to build from
      Returns:
      a ContextInfo object for OperationType.UPDATE
    • getIdempotentMessageService

      protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService getIdempotentMessageService()
    • getTypeFactory

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

      protected CartService<com.broadleafcommerce.cart.client.domain.Cart> getCartService()