Class 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)
    • 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 the IndexableType 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 a DocumentContext 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()