Class PurgeAbandonedCartsJobListener
- java.lang.Object
-
- com.broadleafcommerce.cart.service.purge.PurgeAbandonedCartsJobListener
-
@DataRouteByKey("cart") public class PurgeAbandonedCartsJobListener extends Object
Listener to initiate the purging of outdated anonymous carts.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_CART_TIMEOUT
static String
DEFAULT_STATUS
static String
DETAIL_KEY_CART_TIMEOUT
static String
DETAIL_KEY_STATUS
static String
JOB_TYPE
-
Constructor Summary
Constructors Constructor Description PurgeAbandonedCartsJobListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentService, CartService<com.broadleafcommerce.cart.client.domain.Cart> cartService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,String>
buildJobDetailsMap(com.broadleafcommerce.common.messaging.domain.ScheduledJobRef scheduledJobRef)
Build a map from the scheduled job details.protected Duration
getAbandonedCartTimeout(Map<String,String> jobDetails)
Get the abandoned cart timeout from the job details map or the default value.protected CartService<com.broadleafcommerce.cart.client.domain.Cart>
getCartService()
protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService
getIdempotentService()
protected com.broadleafcommerce.data.tracking.core.service.scheduledjob.ScheduledJobContextService
getScheduledJobContextService()
protected Collection<String>
getStatuses(Map<String,String> jobDetails)
Get the statuses to purge from the job details map or the default value.void
listen(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
protected void
process(com.broadleafcommerce.common.messaging.domain.ScheduledJobRef scheduledJobRef)
Purge anonymous carts after configurable time has passedvoid
setScheduledJobContextService(com.broadleafcommerce.data.tracking.core.service.scheduledjob.ScheduledJobContextService scheduledJobContextService)
-
-
-
Field Detail
-
JOB_TYPE
public static final String JOB_TYPE
- See Also:
- Constant Field Values
-
DETAIL_KEY_CART_TIMEOUT
public static final String DETAIL_KEY_CART_TIMEOUT
- See Also:
- Constant Field Values
-
DETAIL_KEY_STATUS
public static final String DETAIL_KEY_STATUS
- See Also:
- Constant Field Values
-
DEFAULT_CART_TIMEOUT
public static final String DEFAULT_CART_TIMEOUT
- See Also:
- Constant Field Values
-
DEFAULT_STATUS
public static final String DEFAULT_STATUS
-
-
Constructor Detail
-
PurgeAbandonedCartsJobListener
public PurgeAbandonedCartsJobListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentService, CartService<com.broadleafcommerce.cart.client.domain.Cart> cartService)
-
-
Method Detail
-
listen
@StreamListener("triggeredJobEventInputPurgeCarts") public void listen(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message)
-
process
protected void process(com.broadleafcommerce.common.messaging.domain.ScheduledJobRef scheduledJobRef)
Purge anonymous carts after configurable time has passed- Parameters:
scheduledJobRef
- The job being executed
-
buildJobDetailsMap
protected Map<String,String> buildJobDetailsMap(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
-
getAbandonedCartTimeout
protected Duration getAbandonedCartTimeout(Map<String,String> jobDetails)
Get the abandoned cart timeout from the job details map or the default value.- Parameters:
jobDetails
- Map ofScheduledJobDetailRef
- Returns:
- The amount of time since last update until a cart is considered abandoned.
-
getStatuses
protected Collection<String> getStatuses(Map<String,String> jobDetails)
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.
-
getIdempotentService
protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService getIdempotentService()
-
getCartService
protected CartService<com.broadleafcommerce.cart.client.domain.Cart> getCartService()
-
setScheduledJobContextService
@Autowired public void setScheduledJobContextService(com.broadleafcommerce.data.tracking.core.service.scheduledjob.ScheduledJobContextService scheduledJobContextService)
-
getScheduledJobContextService
protected com.broadleafcommerce.data.tracking.core.service.scheduledjob.ScheduledJobContextService getScheduledJobContextService()
-
-