Class AbstractSingleIndexRequestHandler
java.lang.Object
com.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
SingleIndexRequestHandlers are responsible for listening for channel events
(
SingleIndexRequest
) associated with a specific Indexable
repository domain type.
These events are emitted in response to persistence state change for entities and are delivered
in the form of a JSON representation built by the corresponding
SingleIndexRequestMessageBuilder
.- Author:
- Samarth Dhruva (samarthd)
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractSingleIndexRequestHandler
(com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.fasterxml.jackson.databind.ObjectMapper
abstract String[]
The simple originating entity type names supported by this handler.void
Entry point for the handler.abstract void
Hook point for message listeners to bind to the input channel with@StreamListener
.boolean
isValidType
(String reportedType) Determine if the reported type (i.e.abstract void
processSingleIndexRequest
(com.fasterxml.jackson.databind.JsonNode singleIndexRequest) Handle the JSON representation of the SingleIndexRequest message that has been deemed appropriate for this handler based on comparing the expected_class
parameter in the JSON against the generic type of the handler implementation.
-
Constructor Details
-
AbstractSingleIndexRequestHandler
public AbstractSingleIndexRequestHandler(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
hook
Hook point for message listeners to bind to the input channel with@StreamListener
. Implementations of this method generally delegate tohandle(String)
. It is generally important that each input channel name is unique in order to guarantee other listeners will still process the persistence message, even if one or more other listeners throw exceptions. As a corollary, there will also generally be a unique@Input
annotatedSubscribableChannel
instance per listener tied to the unique input channel.- Parameters:
singleIndexRequest
- The JSON representation of the request
-
handle
Entry point for the handler. This method will review the json representation and evaluate suitability against thegetSupportedSimpleTypeNames()
types. If appropriate,processSingleIndexRequest(JsonNode)
is called.- Parameters:
singleIndexRequest
- The JSON representation of the single index request
-
isValidType
Determine if the reported type (i.e. class name of the originating entity) of the incoming message is appropriate for this handler.- Parameters:
reportedType
- the reported type of the originating entity on the incoming message- Returns:
- Whether or not the type is supported by this handler
- See Also:
-
SingleIndexRequest.get_class()
-
getSupportedSimpleTypeNames
The simple originating entity type names supported by this handler. This is not the fully qualified classname, rather the simple name - similar to what is returned byClass.getSimpleName()
.- Returns:
- The array of simple type names supported by this handler
- See Also:
-
processSingleIndexRequest
public abstract void processSingleIndexRequest(com.fasterxml.jackson.databind.JsonNode singleIndexRequest) Handle the JSON representation of the SingleIndexRequest message that has been deemed appropriate for this handler based on comparing the expected_class
parameter in the JSON against the generic type of the handler implementation.- Parameters:
singleIndexRequest
- The JSON representation of the single index request- Throws:
com.broadleafcommerce.search.api.SearchIndexException
- thrown if the reindexing process is unsuccessful
-
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
-