luchunliang commented on code in PR #3785:
URL: https://github.com/apache/incubator-inlong/pull/3785#discussion_r855744616
##########
inlong-sort-standalone/sort-standalone-source/src/main/java/org/apache/inlong/sort/standalone/sink/elasticsearch/EsSinkContext.java:
##########
@@ -565,21 +550,25 @@ public void setUseIndexId(boolean isUseIndexId) {
}
/**
- * get indexRequestHandler
+ * create indexRequestHandler
*
* @return the indexRequestHandler
*/
- public IEvent2IndexRequestHandler getIndexRequestHandler() {
- return indexRequestHandler;
- }
-
- /**
- * set indexRequestHandler
- *
- * @param indexRequestHandler the indexRequestHandler to set
- */
- public void setIndexRequestHandler(IEvent2IndexRequestHandler
indexRequestHandler) {
- this.indexRequestHandler = indexRequestHandler;
+ public IEvent2IndexRequestHandler createIndexRequestHandler() {
+ // IEvent2IndexRequestHandler
+ String indexRequestHandlerClass =
CommonPropertiesHolder.getString(KEY_EVENT_INDEXREQUEST_HANDLER,
+ DefaultEvent2IndexRequestHandler.class.getName());
+ try {
+ Class<?> handlerClass =
ClassUtils.getClass(indexRequestHandlerClass);
+ Object handlerObject =
handlerClass.getDeclaredConstructor().newInstance();
+ if (handlerObject instanceof IEvent2IndexRequestHandler) {
+ IEvent2IndexRequestHandler handler =
(IEvent2IndexRequestHandler) handlerObject;
+ return handler;
+ }
+ } catch (Throwable t) {
+ LOG.error("Fail to init
IEvent2IndexRequestHandler,handlerClass:{},error:{}",
Review Comment:
ok, print all exception stacks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]