Class AbstractFullIndexMessageListener
java.lang.Object
com.broadleafcommerce.search.index.core.messaging.AbstractFullIndexMessageListener
An abstract message listener that triggers when a full index message is received.
- Author:
- Elbert Bautista (elbertbautista)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractFullIndexMessageListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ReindexDelegationService reindexDelegationService) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Map<String,Serializable> getAdditionalProperties(com.jayway.jsonpath.DocumentContext jsonContext) Determine the additional properties needed for a reindexprotected abstract StringGet the class name to identify this listener for handling message idempotency.protected com.jayway.jsonpath.DocumentContextgetDocumentContext(@NonNull String payload) Parses the message payload into aDocumentContextwhich allows for JsonPath parsing using Jackson providers.protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionServiceprotected abstract com.broadleafcommerce.search.api.type.IndexableTypeGet theIndexableTypeidentified for this listener.protected com.fasterxml.jackson.databind.ObjectMapperprotected StringgetPayload(org.springframework.messaging.Message<String> message) Get the message payload and customize it if needed.protected ReindexDelegationServiceprotected voidhandleMessageInternal(org.springframework.messaging.Message<String> message) Message listener entry point.protected voidprocessMessage(org.springframework.messaging.Message<String> message) Processes the received message by extracting fields relevant to executing a full re-indexprotected abstract booleanvalidateShouldReindex(com.jayway.jsonpath.DocumentContext jsonContext) Validate that the message state is valid to execute a re-index
-
Field Details
-
INDEXER_ROUTE_KEY
- See Also:
-
INDEX_TYPE_PATH
- See Also:
-
AUTHOR_PATH
- See Also:
-
NAME_KEY_PATH
- See Also:
-
-
Constructor Details
-
AbstractFullIndexMessageListener
public AbstractFullIndexMessageListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ReindexDelegationService reindexDelegationService)
-
-
Method Details
-
handleMessageInternal
Message listener entry point. Checks if the message has already been received and, if not, begins processing it.- Parameters:
message- the message payload
-
getClassName
Get the class name to identify this listener for handling message idempotency.- Returns:
- the listener's class name
-
getIndexableType
protected abstract com.broadleafcommerce.search.api.type.IndexableType getIndexableType()Get theIndexableTypeidentified for this listener.- Returns:
- the listener's indexable type
-
processMessage
Processes the received message by extracting fields relevant to executing a full re-index- Parameters:
message- the message payload
-
getPayload
Get the message payload and customize it if needed.- Parameters:
message- the message payload- Returns:
- string version of the message payload
-
getDocumentContext
Parses the message payload into aDocumentContextwhich allows for JsonPath parsing using Jackson providers.- Parameters:
payload- the message payload- Returns:
- a
DocumentContext` representation of the message payload
-
validateShouldReindex
protected abstract boolean validateShouldReindex(com.jayway.jsonpath.DocumentContext jsonContext) Validate that the message state is valid to execute a re-index- Parameters:
jsonContext- the message payload- Returns:
- whether a re-index should be performed
-
getAdditionalProperties
protected abstract Map<String,Serializable> getAdditionalProperties(com.jayway.jsonpath.DocumentContext jsonContext) Determine the additional properties needed for a reindex- Parameters:
jsonContext- the message payload- Returns:
- the additional properties to be passed into reindex service
-
getIdempotentConsumptionService
protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService getIdempotentConsumptionService() -
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() -
getReindexDelegationService
-