You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/01/26 02:41:24 UTC

[GitHub] [incubator-inlong] imvan commented on a change in pull request #2327: [INLONG-2326] Inlong-Sort-Standalone support to sort the events to ElasticSearch cluster.

imvan commented on a change in pull request #2327:
URL: https://github.com/apache/incubator-inlong/pull/2327#discussion_r792276524



##########
File path: inlong-sort-standalone/sort-standalone-source/src/main/java/org/apache/inlong/sort/standalone/sink/elasticsearch/EsCallbackListener.java
##########
@@ -0,0 +1,120 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.sort.standalone.sink.elasticsearch;
+
+import java.util.List;
+
+import org.apache.inlong.sort.standalone.channel.ProfileEvent;
+import org.apache.inlong.sort.standalone.utils.InlongLoggerFactory;
+import org.elasticsearch.action.DocWriteRequest;
+import org.elasticsearch.action.bulk.BulkItemResponse;
+import org.elasticsearch.action.bulk.BulkProcessor;
+import org.elasticsearch.action.bulk.BulkRequest;
+import org.elasticsearch.action.bulk.BulkResponse;
+import org.slf4j.Logger;
+
+/**
+ * EsCallbackListener
+ *
+ */
+public class EsCallbackListener implements BulkProcessor.Listener {
+
+    public static final Logger LOG = InlongLoggerFactory.getLogger(EsCallbackListener.class);
+
+    private EsSinkContext context;
+
+    /**
+     * Constructor
+     * 
+     * @param context
+     */
+    public EsCallbackListener(EsSinkContext context) {
+        this.context = context;
+    }
+
+    /**
+     * beforeBulk
+     * 
+     * @param executionId
+     * @param request
+     */
+    @Override
+    public void beforeBulk(long executionId, BulkRequest request) {
+//      LOG.info("beforeBulk,executionId:" + executionId + ",request:" + request);
+    }
+
+    /**
+     * afterBulk
+     * 
+     * @param executionId
+     * @param request
+     * @param response
+     */
+    @Override
+    public void afterBulk(long executionId, BulkRequest request, BulkResponse response) {
+//      LOG.info("afterBulk,executionId:" + executionId + ",request:" + request + ",response:" + response);

Review comment:
       remove commented code or use LOG.debug




-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org