Class ProductSingleIndexRequestHandler
- java.lang.Object
-
- com.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
-
- com.broadleafcommerce.search.index.catalog.messaging.handler.AbstractProductSingleIndexRequestHandler
-
- com.broadleafcommerce.search.index.catalog.messaging.handler.ProductSingleIndexRequestHandler
-
public class ProductSingleIndexRequestHandler extends AbstractProductSingleIndexRequestHandler
Listens for single index requests originating from changes to Products and sends them to be updated in the index. This implementation only looks at requests originating from Products. Requests originating from updates to entities/documents related to products (e.g. Categories, Assets, etc) are handled inAncillaryProductSingleIndexRequestHandler
.The default flow of this handler is as follows:
- Delete all products from the index matching the contextId of the product in the single index request.
- Read all products from catalog matching the contextId of the single index request.
- Reindex all products returned from the previous step.
The reason for reading all products is due to catalog overrides and sandbox documents. In order to get a complete view of the catalog and sandbox hierarchy, we must read all products. A single persistence event can potentially affect all products in the hierarchy, thus requires a reindex of all products matching a particular contextId.
-
-
Field Summary
Fields Modifier and Type Field Description static String
PRODUCT_CTX_ID_PATH
protected static String[]
supportedSimpleTypeNames
-
Constructor Summary
Constructors Constructor Description ProductSingleIndexRequestHandler(CatalogService catalogService, com.broadleafcommerce.search.index.core.service.ReindexDelegationService reindexDelegationService, com.broadleafcommerce.search.index.core.service.ReindexService reindexService, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getProductCtxIdPath()
Get the path for retrieving the product context ID from a single index request JSON payload.String[]
getSupportedSimpleTypeNames()
void
hook(String singleIndexRequest)
void
processSingleIndexRequest(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)
-
Methods inherited from class com.broadleafcommerce.search.index.catalog.messaging.handler.AbstractProductSingleIndexRequestHandler
getCatalogService, getProductCtxId, getReindexDelegationService, getReindexService, readProducts
-
-
-
-
Field Detail
-
supportedSimpleTypeNames
protected static final String[] supportedSimpleTypeNames
-
PRODUCT_CTX_ID_PATH
public static final String PRODUCT_CTX_ID_PATH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ProductSingleIndexRequestHandler
public ProductSingleIndexRequestHandler(CatalogService catalogService, com.broadleafcommerce.search.index.core.service.ReindexDelegationService reindexDelegationService, com.broadleafcommerce.search.index.core.service.ReindexService reindexService, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Detail
-
hook
@StreamListener("singleIndexRequestInputProduct") public void hook(String singleIndexRequest)
- Specified by:
hook
in classcom.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
-
processSingleIndexRequest
public void processSingleIndexRequest(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)
- Specified by:
processSingleIndexRequest
in classcom.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
-
getSupportedSimpleTypeNames
public String[] getSupportedSimpleTypeNames()
- Specified by:
getSupportedSimpleTypeNames
in classcom.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
-
getProductCtxIdPath
protected String getProductCtxIdPath()
Description copied from class:AbstractProductSingleIndexRequestHandler
Get the path for retrieving the product context ID from a single index request JSON payload.- Specified by:
getProductCtxIdPath
in classAbstractProductSingleIndexRequestHandler
- Returns:
- path to product context ID
-
-