Class AbstractFullIndexMessageListener
- java.lang.Object
-
- com.broadleafcommerce.search.index.core.messaging.AbstractFullIndexMessageListener
-
@DataRouteByKey("indexer") public abstract class AbstractFullIndexMessageListener extends Object
An abstract message listener that triggers when a full index message is received.- Author:
- Elbert Bautista (elbertbautista)
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
AUTHOR_PATH
protected static String
INDEX_TYPE_PATH
static String
INDEXER_ROUTE_KEY
protected static String
NAME_KEY_PATH
-
Constructor Summary
Constructors Constructor Description AbstractFullIndexMessageListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ReindexDelegationService reindexDelegationService)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Map<String,Serializable>
getAdditionalProperties(com.jayway.jsonpath.DocumentContext jsonContext)
Determine the additional properties needed for a reindexprotected abstract String
getClassName()
Get the class name to identify this listener for handling message idempotency.protected com.jayway.jsonpath.DocumentContext
getDocumentContext(@NonNull String payload)
Parses the message payload into aDocumentContext
which allows for JsonPath parsing using Jackson providers.protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService
getIdempotentConsumptionService()
protected abstract com.broadleafcommerce.search.api.type.IndexableType
getIndexableType()
Get theIndexableType
identified for this listener.protected com.fasterxml.jackson.databind.ObjectMapper
getObjectMapper()
protected String
getPayload(org.springframework.messaging.Message<String> message)
Get the message payload and customize it if needed.protected ReindexDelegationService
getReindexDelegationService()
protected void
handleMessageInternal(org.springframework.messaging.Message<String> message)
Message listener entry point.protected void
processMessage(org.springframework.messaging.Message<String> message)
Processes the received message by extracting fields relevant to executing a full re-indexprotected abstract boolean
validateShouldReindex(com.jayway.jsonpath.DocumentContext jsonContext)
Validate that the message state is valid to execute a re-index
-
-
-
Field Detail
-
INDEXER_ROUTE_KEY
public static final String INDEXER_ROUTE_KEY
- See Also:
- Constant Field Values
-
INDEX_TYPE_PATH
protected static final String INDEX_TYPE_PATH
- See Also:
- Constant Field Values
-
AUTHOR_PATH
protected static final String AUTHOR_PATH
- See Also:
- Constant Field Values
-
NAME_KEY_PATH
protected static final String NAME_KEY_PATH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractFullIndexMessageListener
public AbstractFullIndexMessageListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ReindexDelegationService reindexDelegationService)
-
-
Method Detail
-
handleMessageInternal
protected void handleMessageInternal(org.springframework.messaging.Message<String> message)
Message listener entry point. Checks if the message has already been received and, if not, begins processing it.- Parameters:
message
- the message payload
-
getClassName
protected abstract String 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 theIndexableType
identified for this listener.- Returns:
- the listener's indexable type
-
processMessage
protected void processMessage(org.springframework.messaging.Message<String> message)
Processes the received message by extracting fields relevant to executing a full re-index- Parameters:
message
- the message payload
-
getPayload
protected String getPayload(org.springframework.messaging.Message<String> message)
Get the message payload and customize it if needed.- Parameters:
message
- the message payload- Returns:
- string version of the message payload
-
getDocumentContext
protected com.jayway.jsonpath.DocumentContext getDocumentContext(@NonNull @NonNull String payload)
Parses the message payload into aDocumentContext
which 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
protected ReindexDelegationService getReindexDelegationService()
-
-