Class OrderSubmittedInventoryAdjustmentMessageListener
- java.lang.Object
-
- com.broadleafcommerce.inventory.service.messaging.AbstractInventoryAdjustmentListener
-
- com.broadleafcommerce.inventory.service.messaging.checkout.OrderSubmittedInventoryAdjustmentMessageListener
-
@DataRouteByKey("inventory") public class OrderSubmittedInventoryAdjustmentMessageListener extends AbstractInventoryAdjustmentListener
Message Listener to listen for submitted orders, parse them, and create HARD_RESERVATIONInventoryTransaction
(i.e. HARD Reservations).- Author:
- Kelly Tisdell (ktisdell), Nathan Moore (nathandmoore)
-
-
Field Summary
Fields Modifier and Type Field Description static String
CART_ID_PATH
static String
CART_ITEM_LINK_PATH
The path to the cart item link.static String
CART_ITEMS_PATH
Deprecated.since 1.5.static String
FULFILLMENT_GROUP_LINK_PATH
The path to the fulfillment group link.static String
FULFILLMENT_GROUPS_PATH
Deprecated.since 1.5.static String
ORDER_STATUS_PATH
static String
SUBMITTED_STATUS
-
Fields inherited from class com.broadleafcommerce.inventory.service.messaging.AbstractInventoryAdjustmentListener
APPLICATION_ID_PATH, TENANT_ID_PATH
-
-
Constructor Summary
Constructors Constructor Description OrderSubmittedInventoryAdjustmentMessageListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentMessageConsumptionService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, SkuInventoryService<SkuInventory> skuInventoryService, CartProvider cartProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<SkuInventoryAdjustmentRequestItem>
buildRequestedItems(@NonNull Map<String,? extends CartItem> cartItems, @NonNull List<? extends FulfillmentItem> fulfillmentItems)
Iterates over thefulfillmentItems
to determine for which aSkuInventoryAdjustmentRequestItem
should be made.protected SkuInventoryReservationRequest
buildSkuInventoryReservationRequest(@NonNull com.jayway.jsonpath.DocumentContext jsonContext, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Builds theSkuInventoryReservationRequest
based on the fulfillment info in the checkout completion message.protected CartProvider
getCartProvider()
void
listen(org.springframework.messaging.Message<String> message)
void
processMessage(@NonNull org.springframework.messaging.Message<String> message)
Processes the received message by extracting fields relevant for recording inventory adjustments.-
Methods inherited from class com.broadleafcommerce.inventory.service.messaging.AbstractInventoryAdjustmentListener
buildContextInfo, buildContextInfo, getDocumentContext, getIdempotentConsumptionService, getSkuInventoryService, getSkuReferenceFieldType, getTypeFactory
-
-
-
-
Field Detail
-
SUBMITTED_STATUS
public static final String SUBMITTED_STATUS
- See Also:
- Constant Field Values
-
CART_ID_PATH
public static final String CART_ID_PATH
- See Also:
- Constant Field Values
-
ORDER_STATUS_PATH
public static final String ORDER_STATUS_PATH
- See Also:
- Constant Field Values
-
CART_ITEMS_PATH
@Deprecated public static final String CART_ITEMS_PATH
Deprecated.since 1.5. Cart items now need to be read from the cart service. SeeCartProvider
andCART_ITEM_LINK_PATH
- See Also:
- Constant Field Values
-
FULFILLMENT_GROUPS_PATH
@Deprecated public static final String FULFILLMENT_GROUPS_PATH
Deprecated.since 1.5. Fulfillment groups now need to be read from the cart service. SeeCartProvider
andFULFILLMENT_GROUP_LINK_PATH
- See Also:
- Constant Field Values
-
CART_ITEM_LINK_PATH
public static final String CART_ITEM_LINK_PATH
The path to the cart item link. This link must be used to retrieve cart items via GET request to the cart service.- See Also:
- Constant Field Values
-
FULFILLMENT_GROUP_LINK_PATH
public static final String FULFILLMENT_GROUP_LINK_PATH
The path to the fulfillment group link. This link must be used to retrieve fulfillment groups via GET request to the cart service.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OrderSubmittedInventoryAdjustmentMessageListener
public OrderSubmittedInventoryAdjustmentMessageListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentMessageConsumptionService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, SkuInventoryService<SkuInventory> skuInventoryService, CartProvider cartProvider)
-
-
Method Detail
-
listen
@StreamListener("checkoutCompletionInputInventory") public void listen(org.springframework.messaging.Message<String> message)
-
processMessage
public void processMessage(@NonNull @NonNull org.springframework.messaging.Message<String> message)
Processes the received message by extracting fields relevant for recording inventory adjustments.- Parameters:
message
- The checkout completion message received with payload
-
buildSkuInventoryReservationRequest
protected SkuInventoryReservationRequest buildSkuInventoryReservationRequest(@NonNull @NonNull com.jayway.jsonpath.DocumentContext jsonContext, @NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Builds theSkuInventoryReservationRequest
based on the fulfillment info in the checkout completion message.- Parameters:
jsonContext
- aDocumentContext
representation of the checkout completion message payloadcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- The
SkuInventoryReservationRequest
based on the fulfillment info in the checkout completion message.
-
buildRequestedItems
protected List<SkuInventoryAdjustmentRequestItem> buildRequestedItems(@NonNull @NonNull Map<String,? extends CartItem> cartItems, @NonNull @NonNull List<? extends FulfillmentItem> fulfillmentItems)
Iterates over thefulfillmentItems
to determine for which aSkuInventoryAdjustmentRequestItem
should be made.- Parameters:
cartItems
- The cart line items with the merchandise informationfulfillmentItems
- The fulfillment items corresponding to thecartItems
that represent the fulfillment information for those particular line items. These contain the information necessary to determine whether to build aSkuInventoryAdjustmentRequestItem
.- Returns:
- A list of
SkuInventoryReservationRequestItems
that should be handled by the inventory service
-
getCartProvider
protected CartProvider getCartProvider()
-
-