Class DefaultStockChangeNotificationService
java.lang.Object
com.broadleafcommerce.inventory.service.DefaultStockChangeNotificationService
- All Implemented Interfaces:
StockChangeNotificationService
public class DefaultStockChangeNotificationService
extends Object
implements StockChangeNotificationService
Default component that sends stock change notifications via Spring Cloud Stream.
- Author:
- Kelly Tisdell (ktisdell)
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultStockChangeNotificationService(SkuInventorySummaryService<?> skuInventorySummaryService, StockAvailabilityChangeNotifcationProducer stockAvailabilityChangeNotifcationProducer, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.messaging.Message<ConsolidatedInventoryAvailability>createMessage(ConsolidatedInventoryAvailability consolidatedInventoryAvailability) protected com.fasterxml.jackson.databind.ObjectMapperprotected org.springframework.context.ApplicationEventPublisherprotected SkuInventorySummaryService<?>protected com.broadleafcommerce.common.extension.TypeFactoryvoidnotifyOfStockChange(String skuCode, int previousQuantityAvailable, int newQuantityAvailable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) API to notify, typically via an asynchronous message, that stock has become available or unavailable for a tenant or application.voidsetPublisher(org.springframework.context.ApplicationEventPublisher publisher)
-
Constructor Details
-
DefaultStockChangeNotificationService
public DefaultStockChangeNotificationService(SkuInventorySummaryService<?> skuInventorySummaryService, StockAvailabilityChangeNotifcationProducer stockAvailabilityChangeNotifcationProducer, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
notifyOfStockChange
public void notifyOfStockChange(@NonNull String skuCode, int previousQuantityAvailable, int newQuantityAvailable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:StockChangeNotificationServiceAPI to notify, typically via an asynchronous message, that stock has become available or unavailable for a tenant or application.- Specified by:
notifyOfStockChangein interfaceStockChangeNotificationService
-
createMessage
protected org.springframework.messaging.Message<ConsolidatedInventoryAvailability> createMessage(ConsolidatedInventoryAvailability consolidatedInventoryAvailability) -
getSkuInventorySummaryService
-
getStockAvailabilityChangeNotifcationProducer
protected StockAvailabilityChangeNotifcationProducer getStockAvailabilityChangeNotifcationProducer() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() -
getPublisher
@Nullable protected org.springframework.context.ApplicationEventPublisher getPublisher() -
setPublisher
@Autowired(required=false) public void setPublisher(org.springframework.context.ApplicationEventPublisher publisher)
-