Class ElasticsearchHandler<I extends Exceptional,O,C extends ErrorCollector<O>>
java.lang.Object
org.elasticsearch.hadoop.handler.impl.elasticsearch.ElasticsearchHandler<I,O,C>
- Type Parameters:
I- type of error eventO- in case of retries, this is the type of the retry valueC- the type of error collector used
- All Implemented Interfaces:
ErrorHandler<I,O, C>
public class ElasticsearchHandler<I extends Exceptional,O,C extends ErrorCollector<O>>
extends Object
implements ErrorHandler<I,O,C>
Generic Error Handler that converts error events into JSON documents, and stores them in an Elasticsearch index.
Handler results returned from this handler are configurable; In the case that the event is successfully written to Elasticsearch it returns HANDLED by default and if the event cannot be written for any reason it returns ABORT by default.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionElasticsearchHandler(Settings rootSettings, EventConverter<I> eventConverter) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Called at the close of the connector to clean up any internal resources.static <I extends Exceptional,O, C extends ErrorCollector<O>>
ElasticsearchHandler<I,O, C> create(Settings rootSettings, EventConverter<I> converter) voidinit(Properties properties) Called at the handler creation time to initialize any internal state or resources.Called when an exception or failure occurs in a part of the connector.
-
Field Details
-
CONF_RETURN_VALUE
- See Also:
-
CONF_RETURN_VALUE_DEFAULT
-
CONF_RETURN_ERROR
- See Also:
-
CONF_RETURN_ERROR_DEFAULT
-
CONF_PASS_REASON_SUFFIX
- See Also:
-
CONF_LABEL
- See Also:
-
CONF_TAGS
- See Also:
-
CONF_CLIENT_NODES
- See Also:
-
CONF_CLIENT_PORT
- See Also:
-
CONF_CLIENT_RESOURCE
- See Also:
-
CONF_CLIENT_INHERIT
- See Also:
-
CONF_CLIENT_CONF
- See Also:
-
-
Constructor Details
-
ElasticsearchHandler
-
-
Method Details
-
create
public static <I extends Exceptional,O, ElasticsearchHandler<I,C extends ErrorCollector<O>> O, createC> (Settings rootSettings, EventConverter<I> converter) -
init
Description copied from interface:ErrorHandlerCalled at the handler creation time to initialize any internal state or resources.- Specified by:
initin interfaceErrorHandler<I extends Exceptional,O, C extends ErrorCollector<O>> - Parameters:
properties- Properties for this handler with handler name prefix stripped away.
-
onError
Description copied from interface:ErrorHandlerCalled when an exception or failure occurs in a part of the connector.- Specified by:
onErrorin interfaceErrorHandler<I extends Exceptional,O, C extends ErrorCollector<O>> - Parameters:
entry- information about the failure, normally includes operational data and error informationcollector- handler for accepting user reactions to the failure, like retrying with modified parameters- Returns:
- An enum that describes the handler's result, either that it handled the error or if the error should be passed on to the next handler.
- Throws:
Exception- In the event that the current failure should not be handled, and should halt the connector processing.
-
close
public void close()Description copied from interface:ErrorHandlerCalled at the close of the connector to clean up any internal resources.- Specified by:
closein interfaceErrorHandler<I extends Exceptional,O, C extends ErrorCollector<O>>
-