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 13:02:11 UTC

[GitHub] [incubator-inlong] imvan opened a new pull request #2359: [INLONG-1896][Feature][Sort] Inlong-Sort-Standalone support to sort the events to Kafka clusters.

imvan opened a new pull request #2359:
URL: https://github.com/apache/incubator-inlong/pull/2359


   ### [INLONG-1896][Feature][Sort]  SInlong-Sort-Standalone support to sort the events to Kafka clusters.
   
   Fixes #1896 
   
   ### Motivation
   
   Enable sort-standalone sort the events to kafka clusters
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   


-- 
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



[GitHub] [incubator-inlong] imvan commented on a change in pull request #2359: [INLONG-1896][Feature][Sort] Inlong-Sort-Standalone support to sort the events to Kafka clusters.

Posted by GitBox <gi...@apache.org>.
imvan commented on a change in pull request #2359:
URL: https://github.com/apache/incubator-inlong/pull/2359#discussion_r803260129



##########
File path: inlong-sort-standalone/sort-standalone-source/src/main/java/org/apache/inlong/sort/standalone/sink/kafka/KafkaProducerCluster.java
##########
@@ -0,0 +1,235 @@
+/**
+ * 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.kafka;
+
+import com.google.common.base.Preconditions;
+import org.apache.flume.Context;
+import org.apache.flume.Event;
+import org.apache.flume.Transaction;
+import org.apache.flume.lifecycle.LifecycleAware;
+import org.apache.flume.lifecycle.LifecycleState;
+import org.apache.inlong.sort.standalone.config.holder.CommonPropertiesHolder;
+import org.apache.inlong.sort.standalone.config.pojo.CacheClusterConfig;
+import org.apache.inlong.sort.standalone.metrics.SortMetricItem;
+import org.apache.inlong.sort.standalone.metrics.audit.AuditUtils;
+import org.apache.inlong.sort.standalone.utils.Constants;
+import org.apache.inlong.sort.standalone.utils.InlongLoggerFactory;
+import org.apache.kafka.clients.producer.KafkaProducer;
+import org.apache.kafka.clients.producer.ProducerConfig;
+import org.apache.kafka.clients.producer.ProducerRecord;
+import org.apache.kafka.common.serialization.ByteArraySerializer;
+import org.apache.kafka.common.serialization.StringSerializer;
+import org.apache.pulsar.shade.org.apache.commons.lang.math.NumberUtils;
+import org.slf4j.Logger;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/** wrapper of kafka producer */
+public class KafkaProducerCluster implements LifecycleAware {
+    public static final Logger LOG = InlongLoggerFactory.getLogger(KafkaProducerCluster.class);
+
+    private static final String KEY_RETRIES = "retries";
+    private static final String KEY_ACKS = "acks";
+    private static final String KEY_BATCH_SIZE = "batch.size";
+    private static final String KEY_LINGER_MS = "linger.ms";
+    private static final String KEY_MAX_REQUEST_SIZE = "max.request.size";
+    private static final String KEY_BUFFER_MEMORY = "buffer.memory";
+    private static final String KEY_RECEIVE_BUFFER_BYTES = "receive.buffer.bytes";
+    private static final String KEY_SEND_BUFFER_BYTES = "send.buffer.bytes";
+    private static final String KEY_METADATA_FETCH_TIMEOUT_MS = "metadata.fetch.timeout.ms";
+    private static final String KEY_METADATA_MAX_AGE_MS = "metadata.max.age.ms";
+    private static final String KEY_COMPRESSION_TYPE = "compression.type";
+    private static final String KEY_MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION =
+            "max.in.flight.requests.per.connection";
+    private static final String KEY_TIMEOUT_MS = "rpc.timeout.ms";
+    private static final String KEY_DELIVERY_TIMEOUT_MS = "delivery.timeout.ms";
+    private static final String KEY_REQUEST_TIMEOUT_MS = "request.timeout.ms";
+    private static final String KEY_ENABLE_REPLACE_PARTITION_FOR_NOT_LEADER =
+            "enable.replace.partition.for.not.leader";
+    private static final String KEY_ENABLE_REPLACE_PARTITION_FOR_CAN_RETRY =
+            "enable.replace.partition.for.can.retry";
+    private static final String KEY_ENABLE_TOPIC_PARTITION_CIRCUIT_BREAKER =
+            "enable.topic.partition.circuit.breaker";
+    private static final String KEY_MUTE_PARTITION_ERROR_MAX_TIMES =
+            "mute.partition.error.max.times";
+    private static final String KEY_MUTE_PARTITION_MAX_PERCENTAGE = "mute.partition.max.percentage";
+    private static final String KEY_UNMUTE_PARTITION_INTERVAL_MS = "unmute.partition.interval.ms";
+    private static final String KEY_MAX_BLOCK_MS = "max.block.ms";

Review comment:
       fixed




-- 
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



[GitHub] [incubator-inlong] dockerzhang commented on a change in pull request #2359: [INLONG-1896][Feature][Sort] Inlong-Sort-Standalone support to sort the events to Kafka clusters.

Posted by GitBox <gi...@apache.org>.
dockerzhang commented on a change in pull request #2359:
URL: https://github.com/apache/incubator-inlong/pull/2359#discussion_r802581089



##########
File path: inlong-sort-standalone/pom.xml
##########
@@ -43,14 +43,14 @@
         <flume.version>1.9.0</flume.version>
         <plugin.assembly.version>3.2.0</plugin.assembly.version>
         <pulsar.version>2.7.2</pulsar.version>
+        <kafka.version>2.4.1</kafka.version>
         <junit.version>4.13</junit.version>
         <powermock.version>2.0.2</powermock.version>
         <guava.version>19.0</guava.version>
         <skipTests>false</skipTests>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <compiler.source>1.8</compiler.source>
         <compiler.target>1.8</compiler.target>
-        <pulsar.version>2.7.2</pulsar.version>

Review comment:
       use 2.8.1




-- 
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



[GitHub] [incubator-inlong] codecov-commenter commented on pull request #2359: [INLONG-1896][Feature][Sort] Inlong-Sort-Standalone support to sort the events to Kafka clusters.

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #2359:
URL: https://github.com/apache/incubator-inlong/pull/2359#issuecomment-1022187274


   # [Codecov](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2359](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5dc882f) into [master](https://codecov.io/gh/apache/incubator-inlong/commit/ab9e725f5714b8091824764978be7c20e00c1b83?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ab9e725) will **decrease** coverage by `0.00%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-inlong/pull/2359/graphs/tree.svg?width=650&height=150&src=pr&token=1EUK92O9K2&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2359      +/-   ##
   ============================================
   - Coverage     12.53%   12.53%   -0.01%     
   + Complexity     1217     1216       -1     
   ============================================
     Files           420      420              
     Lines         36229    36240      +11     
     Branches       5670     5670              
   ============================================
     Hits           4543     4543              
   - Misses        30882    30891       +9     
   - Partials        804      806       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...inlong/tubemq/manager/service/TaskServiceImpl.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtbWFuYWdlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW5sb25nL3R1YmVtcS9tYW5hZ2VyL3NlcnZpY2UvVGFza1NlcnZpY2VJbXBsLmphdmE=) | `3.65% <0.00%> (-4.88%)` | :arrow_down: |
   | [...ong/tubemq/manager/service/ClusterServiceImpl.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtbWFuYWdlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW5sb25nL3R1YmVtcS9tYW5hZ2VyL3NlcnZpY2UvQ2x1c3RlclNlcnZpY2VJbXBsLmphdmE=) | `50.00% <0.00%> (-2.95%)` | :arrow_down: |
   | [.../inlong/tubemq/server/common/TServerConstants.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtc2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pbmxvbmcvdHViZW1xL3NlcnZlci9jb21tb24vVFNlcnZlckNvbnN0YW50cy5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...g/tubemq/server/broker/web/BrokerAdminServlet.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtc2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pbmxvbmcvdHViZW1xL3NlcnZlci9icm9rZXIvd2ViL0Jyb2tlckFkbWluU2VydmxldC5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...emq/server/broker/offset/DefaultOffsetManager.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtc2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pbmxvbmcvdHViZW1xL3NlcnZlci9icm9rZXIvb2Zmc2V0L0RlZmF1bHRPZmZzZXRNYW5hZ2VyLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [.../producer/qltystats/DefaultBrokerRcvQltyStats.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtY2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pbmxvbmcvdHViZW1xL2NsaWVudC9wcm9kdWNlci9xbHR5c3RhdHMvRGVmYXVsdEJyb2tlclJjdlFsdHlTdGF0cy5qYXZh) | `45.31% <0.00%> (+1.17%)` | :arrow_up: |
   | [.../client/producer/qltystats/BrokerStatsItemSet.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtY2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pbmxvbmcvdHViZW1xL2NsaWVudC9wcm9kdWNlci9xbHR5c3RhdHMvQnJva2VyU3RhdHNJdGVtU2V0LmphdmE=) | `72.09% <0.00%> (+4.65%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ab9e725...5dc882f](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [incubator-inlong] codecov-commenter edited a comment on pull request #2359: [INLONG-1896][Feature][Sort] Inlong-Sort-Standalone support to sort the events to Kafka clusters.

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #2359:
URL: https://github.com/apache/incubator-inlong/pull/2359#issuecomment-1022187274


   # [Codecov](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2359](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0b981ce) into [master](https://codecov.io/gh/apache/incubator-inlong/commit/ab9e725f5714b8091824764978be7c20e00c1b83?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ab9e725) will **decrease** coverage by `0.00%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-inlong/pull/2359/graphs/tree.svg?width=650&height=150&src=pr&token=1EUK92O9K2&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2359      +/-   ##
   ============================================
   - Coverage     12.53%   12.53%   -0.01%     
   - Complexity     1217     1218       +1     
   ============================================
     Files           420      420              
     Lines         36229    36255      +26     
     Branches       5670     5674       +4     
   ============================================
   + Hits           4543     4545       +2     
   - Misses        30882    30901      +19     
   - Partials        804      809       +5     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...inlong/tubemq/manager/controller/TubeMQResult.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtbWFuYWdlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW5sb25nL3R1YmVtcS9tYW5hZ2VyL2NvbnRyb2xsZXIvVHViZU1RUmVzdWx0LmphdmE=) | `60.00% <0.00%> (-3.16%)` | :arrow_down: |
   | [.../inlong/tubemq/corebase/policies/FlowCtrlItem.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW5sb25nL3R1YmVtcS9jb3JlYmFzZS9wb2xpY2llcy9GbG93Q3RybEl0ZW0uamF2YQ==) | `38.88% <0.00%> (-1.12%)` | :arrow_down: |
   | [...long/tubemq/manager/service/MasterServiceImpl.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtbWFuYWdlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW5sb25nL3R1YmVtcS9tYW5hZ2VyL3NlcnZpY2UvTWFzdGVyU2VydmljZUltcGwuamF2YQ==) | `5.79% <0.00%> (-0.87%)` | :arrow_down: |
   | [.../tubemq/corebase/policies/FlowCtrlRuleHandler.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW5sb25nL3R1YmVtcS9jb3JlYmFzZS9wb2xpY2llcy9GbG93Q3RybFJ1bGVIYW5kbGVyLmphdmE=) | `34.07% <0.00%> (-0.45%)` | :arrow_down: |
   | [.../inlong/tubemq/server/common/TServerConstants.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtc2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pbmxvbmcvdHViZW1xL3NlcnZlci9jb21tb24vVFNlcnZlckNvbnN0YW50cy5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...g/tubemq/server/broker/web/BrokerAdminServlet.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtc2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pbmxvbmcvdHViZW1xL3NlcnZlci9icm9rZXIvd2ViL0Jyb2tlckFkbWluU2VydmxldC5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...emq/server/broker/offset/DefaultOffsetManager.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtc2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pbmxvbmcvdHViZW1xL3NlcnZlci9icm9rZXIvb2Zmc2V0L0RlZmF1bHRPZmZzZXRNYW5hZ2VyLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...ager/controller/cluster/request/AddClusterReq.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtbWFuYWdlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW5sb25nL3R1YmVtcS9tYW5hZ2VyL2NvbnRyb2xsZXIvY2x1c3Rlci9yZXF1ZXN0L0FkZENsdXN0ZXJSZXEuamF2YQ==) | `75.00% <0.00%> (ø)` | |
   | [.../producer/qltystats/DefaultBrokerRcvQltyStats.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtY2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pbmxvbmcvdHViZW1xL2NsaWVudC9wcm9kdWNlci9xbHR5c3RhdHMvRGVmYXVsdEJyb2tlclJjdlFsdHlTdGF0cy5qYXZh) | `44.14% <0.00%> (ø)` | |
   | [...ong/tubemq/manager/service/ClusterServiceImpl.java](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtbWFuYWdlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW5sb25nL3R1YmVtcS9tYW5hZ2VyL3NlcnZpY2UvQ2x1c3RlclNlcnZpY2VJbXBsLmphdmE=) | `55.55% <0.00%> (+2.61%)` | :arrow_up: |
   | ... and [1 more](https://codecov.io/gh/apache/incubator-inlong/pull/2359/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ab9e725...0b981ce](https://codecov.io/gh/apache/incubator-inlong/pull/2359?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [incubator-inlong] imvan commented on a change in pull request #2359: [INLONG-1896][Feature][Sort] Inlong-Sort-Standalone support to sort the events to Kafka clusters.

Posted by GitBox <gi...@apache.org>.
imvan commented on a change in pull request #2359:
URL: https://github.com/apache/incubator-inlong/pull/2359#discussion_r803260988



##########
File path: inlong-sort-standalone/sort-standalone-source/src/main/java/org/apache/inlong/sort/standalone/sink/kafka/KafkaFederationWorker.java
##########
@@ -0,0 +1,155 @@
+/**
+ * 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.kafka;
+
+import com.google.common.base.Preconditions;
+import org.apache.flume.Channel;
+import org.apache.flume.Event;
+import org.apache.flume.Transaction;
+import org.apache.flume.lifecycle.LifecycleState;
+import org.apache.inlong.sort.standalone.channel.ProfileEvent;
+import org.apache.inlong.sort.standalone.config.pojo.InlongId;
+import org.apache.inlong.sort.standalone.metrics.SortMetricItem;
+import org.apache.inlong.sort.standalone.utils.Constants;
+import org.apache.inlong.sort.standalone.utils.InlongLoggerFactory;
+import org.apache.pulsar.shade.org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class KafkaFederationWorker extends Thread {
+    public static final Logger LOG = InlongLoggerFactory.getLogger(KafkaFederationWorker.class);
+
+    private final String workerName;
+    private final KafkaFederationSinkContext context;
+
+    private KafkaProducerFederation producerFederation;
+    private LifecycleState status;
+    private Map<String, String> dimensions = new ConcurrentHashMap<>();
+
+    /**
+     * constructor of KafkaFederationWorker
+     *
+     * @param sinkName
+     * @param workerIndex
+     * @param context
+     */
+    public KafkaFederationWorker(
+            String sinkName, int workerIndex, KafkaFederationSinkContext context) {
+        super();
+        this.workerName = sinkName + "-" + workerIndex;
+        this.context = Preconditions.checkNotNull(context);
+        this.producerFederation =
+                new KafkaProducerFederation(String.valueOf(workerIndex), this.context);
+        this.status = LifecycleState.IDLE;
+        this.dimensions.put(SortMetricItem.KEY_CLUSTER_ID, this.context.getClusterId());
+        this.dimensions.put(SortMetricItem.KEY_TASK_NAME, this.context.getTaskName());
+        this.dimensions.put(SortMetricItem.KEY_SINK_ID, this.context.getSinkName());
+    }
+
+    /** entrance of KafkaFederationWorker */
+    @Override
+    public void start() {
+        LOG.info("start a new kafka worker {}", this.workerName);
+        this.producerFederation.start();
+        this.status = LifecycleState.START;
+        super.start();
+    }
+
+    /** close */
+    public void close() {
+        // close all producers
+        LOG.info("close a kafka worker {}", this.workerName);
+        this.producerFederation.close();
+        this.status = LifecycleState.STOP;
+    }
+
+    @Override
+    public void run() {
+        LOG.info("worker {} start to run, the state is {}", this.workerName, status.name());
+        while (status != LifecycleState.STOP) {
+            Transaction tx = null;
+            try {
+                Channel channel = context.getChannel();
+                if (channel == null) {
+                    LOG.error("in kafka worker, channel is null ");
+                    break;
+                }
+                tx = channel.getTransaction();
+                tx.begin();
+                Event rowEvent = channel.take();
+                if (rowEvent == null) {
+                    tx.commit();
+                    tx.close();
+                    sleepOneInterval();
+                    continue;
+                }
+                ProfileEvent event = (ProfileEvent) rowEvent;

Review comment:
       fixed




-- 
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



[GitHub] [incubator-inlong] imvan commented on a change in pull request #2359: [INLONG-1896][Feature][Sort] Inlong-Sort-Standalone support to sort the events to Kafka clusters.

Posted by GitBox <gi...@apache.org>.
imvan commented on a change in pull request #2359:
URL: https://github.com/apache/incubator-inlong/pull/2359#discussion_r803257775



##########
File path: inlong-sort-standalone/pom.xml
##########
@@ -43,14 +43,14 @@
         <flume.version>1.9.0</flume.version>
         <plugin.assembly.version>3.2.0</plugin.assembly.version>
         <pulsar.version>2.7.2</pulsar.version>
+        <kafka.version>2.4.1</kafka.version>
         <junit.version>4.13</junit.version>
         <powermock.version>2.0.2</powermock.version>
         <guava.version>19.0</guava.version>
         <skipTests>false</skipTests>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <compiler.source>1.8</compiler.source>
         <compiler.target>1.8</compiler.target>
-        <pulsar.version>2.7.2</pulsar.version>

Review comment:
       ![image](https://user-images.githubusercontent.com/45282474/153327428-1843f708-9d12-450c-9249-9051062e5bef.png)
   There are two defination of pulsar version, so I remove one of them. 
   And fix it to version 2.8.1




-- 
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



[GitHub] [incubator-inlong] dockerzhang merged pull request #2359: [INLONG-1896][Feature][Sort] Inlong-Sort-Standalone support to sort the events to Kafka clusters.

Posted by GitBox <gi...@apache.org>.
dockerzhang merged pull request #2359:
URL: https://github.com/apache/incubator-inlong/pull/2359


   


-- 
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



[GitHub] [incubator-inlong] luchunliang commented on a change in pull request #2359: [INLONG-1896][Feature][Sort] Inlong-Sort-Standalone support to sort the events to Kafka clusters.

Posted by GitBox <gi...@apache.org>.
luchunliang commented on a change in pull request #2359:
URL: https://github.com/apache/incubator-inlong/pull/2359#discussion_r802230436



##########
File path: inlong-sort-standalone/sort-standalone-source/src/main/java/org/apache/inlong/sort/standalone/sink/kafka/KafkaFederationWorker.java
##########
@@ -0,0 +1,155 @@
+/**
+ * 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.kafka;
+
+import com.google.common.base.Preconditions;
+import org.apache.flume.Channel;
+import org.apache.flume.Event;
+import org.apache.flume.Transaction;
+import org.apache.flume.lifecycle.LifecycleState;
+import org.apache.inlong.sort.standalone.channel.ProfileEvent;
+import org.apache.inlong.sort.standalone.config.pojo.InlongId;
+import org.apache.inlong.sort.standalone.metrics.SortMetricItem;
+import org.apache.inlong.sort.standalone.utils.Constants;
+import org.apache.inlong.sort.standalone.utils.InlongLoggerFactory;
+import org.apache.pulsar.shade.org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class KafkaFederationWorker extends Thread {
+    public static final Logger LOG = InlongLoggerFactory.getLogger(KafkaFederationWorker.class);
+
+    private final String workerName;
+    private final KafkaFederationSinkContext context;
+
+    private KafkaProducerFederation producerFederation;
+    private LifecycleState status;
+    private Map<String, String> dimensions = new ConcurrentHashMap<>();
+
+    /**
+     * constructor of KafkaFederationWorker
+     *
+     * @param sinkName
+     * @param workerIndex
+     * @param context
+     */
+    public KafkaFederationWorker(
+            String sinkName, int workerIndex, KafkaFederationSinkContext context) {
+        super();
+        this.workerName = sinkName + "-" + workerIndex;
+        this.context = Preconditions.checkNotNull(context);
+        this.producerFederation =
+                new KafkaProducerFederation(String.valueOf(workerIndex), this.context);
+        this.status = LifecycleState.IDLE;
+        this.dimensions.put(SortMetricItem.KEY_CLUSTER_ID, this.context.getClusterId());
+        this.dimensions.put(SortMetricItem.KEY_TASK_NAME, this.context.getTaskName());
+        this.dimensions.put(SortMetricItem.KEY_SINK_ID, this.context.getSinkName());
+    }
+
+    /** entrance of KafkaFederationWorker */
+    @Override
+    public void start() {
+        LOG.info("start a new kafka worker {}", this.workerName);
+        this.producerFederation.start();
+        this.status = LifecycleState.START;
+        super.start();
+    }
+
+    /** close */
+    public void close() {
+        // close all producers
+        LOG.info("close a kafka worker {}", this.workerName);
+        this.producerFederation.close();
+        this.status = LifecycleState.STOP;
+    }
+
+    @Override
+    public void run() {
+        LOG.info("worker {} start to run, the state is {}", this.workerName, status.name());
+        while (status != LifecycleState.STOP) {
+            Transaction tx = null;
+            try {
+                Channel channel = context.getChannel();
+                if (channel == null) {
+                    LOG.error("in kafka worker, channel is null ");
+                    break;
+                }
+                tx = channel.getTransaction();
+                tx.begin();
+                Event rowEvent = channel.take();
+                if (rowEvent == null) {
+                    tx.commit();
+                    tx.close();
+                    sleepOneInterval();
+                    continue;
+                }
+                ProfileEvent event = (ProfileEvent) rowEvent;

Review comment:
       Miss check operation.
   rowEvent instanceof ProfileEvent.

##########
File path: inlong-sort-standalone/sort-standalone-source/src/main/java/org/apache/inlong/sort/standalone/sink/kafka/KafkaFederationSink.java
##########
@@ -0,0 +1,99 @@
+/**
+ * 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.kafka;
+
+import org.apache.flume.Context;
+import org.apache.flume.Sink;
+import org.apache.flume.conf.Configurable;
+import org.apache.flume.sink.AbstractSink;
+import org.apache.inlong.sort.standalone.metrics.SortMetricItem;
+import org.apache.inlong.sort.standalone.utils.InlongLoggerFactory;
+import org.slf4j.Logger;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class KafkaFederationSink extends AbstractSink implements Configurable {

Review comment:
       Please use KafkaZone and KafkaCluster name.

##########
File path: inlong-sort-standalone/sort-standalone-source/src/main/java/org/apache/inlong/sort/standalone/sink/kafka/KafkaFederationWorker.java
##########
@@ -0,0 +1,155 @@
+/**
+ * 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.kafka;
+
+import com.google.common.base.Preconditions;
+import org.apache.flume.Channel;
+import org.apache.flume.Event;
+import org.apache.flume.Transaction;
+import org.apache.flume.lifecycle.LifecycleState;
+import org.apache.inlong.sort.standalone.channel.ProfileEvent;
+import org.apache.inlong.sort.standalone.config.pojo.InlongId;
+import org.apache.inlong.sort.standalone.metrics.SortMetricItem;
+import org.apache.inlong.sort.standalone.utils.Constants;
+import org.apache.inlong.sort.standalone.utils.InlongLoggerFactory;
+import org.apache.pulsar.shade.org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class KafkaFederationWorker extends Thread {
+    public static final Logger LOG = InlongLoggerFactory.getLogger(KafkaFederationWorker.class);
+
+    private final String workerName;
+    private final KafkaFederationSinkContext context;
+
+    private KafkaProducerFederation producerFederation;
+    private LifecycleState status;
+    private Map<String, String> dimensions = new ConcurrentHashMap<>();
+
+    /**
+     * constructor of KafkaFederationWorker
+     *
+     * @param sinkName
+     * @param workerIndex
+     * @param context
+     */
+    public KafkaFederationWorker(
+            String sinkName, int workerIndex, KafkaFederationSinkContext context) {
+        super();
+        this.workerName = sinkName + "-" + workerIndex;
+        this.context = Preconditions.checkNotNull(context);
+        this.producerFederation =
+                new KafkaProducerFederation(String.valueOf(workerIndex), this.context);
+        this.status = LifecycleState.IDLE;
+        this.dimensions.put(SortMetricItem.KEY_CLUSTER_ID, this.context.getClusterId());
+        this.dimensions.put(SortMetricItem.KEY_TASK_NAME, this.context.getTaskName());
+        this.dimensions.put(SortMetricItem.KEY_SINK_ID, this.context.getSinkName());
+    }
+
+    /** entrance of KafkaFederationWorker */
+    @Override
+    public void start() {
+        LOG.info("start a new kafka worker {}", this.workerName);
+        this.producerFederation.start();
+        this.status = LifecycleState.START;
+        super.start();
+    }
+
+    /** close */
+    public void close() {
+        // close all producers
+        LOG.info("close a kafka worker {}", this.workerName);
+        this.producerFederation.close();
+        this.status = LifecycleState.STOP;
+    }
+
+    @Override
+    public void run() {
+        LOG.info("worker {} start to run, the state is {}", this.workerName, status.name());
+        while (status != LifecycleState.STOP) {
+            Transaction tx = null;
+            try {
+                Channel channel = context.getChannel();
+                if (channel == null) {
+                    LOG.error("in kafka worker, channel is null ");
+                    break;
+                }
+                tx = channel.getTransaction();
+                tx.begin();
+                Event rowEvent = channel.take();
+                if (rowEvent == null) {
+                    tx.commit();
+                    tx.close();
+                    sleepOneInterval();
+                    continue;
+                }
+                ProfileEvent event = (ProfileEvent) rowEvent;
+                this.fillTopic(event);
+                SortMetricItem.fillInlongId(event, dimensions);
+                this.dimensions.put(
+                        SortMetricItem.KEY_SINK_DATA_ID, event.getHeaders().get(Constants.TOPIC));
+                long msgTime = event.getRawLogTime();
+                long auditFormatTime = msgTime - msgTime % 60000L;

Review comment:
       Please add constant variable for 60000L.

##########
File path: inlong-sort-standalone/sort-standalone-source/src/main/java/org/apache/inlong/sort/standalone/sink/kafka/KafkaProducerCluster.java
##########
@@ -0,0 +1,235 @@
+/**
+ * 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.kafka;
+
+import com.google.common.base.Preconditions;
+import org.apache.flume.Context;
+import org.apache.flume.Event;
+import org.apache.flume.Transaction;
+import org.apache.flume.lifecycle.LifecycleAware;
+import org.apache.flume.lifecycle.LifecycleState;
+import org.apache.inlong.sort.standalone.config.holder.CommonPropertiesHolder;
+import org.apache.inlong.sort.standalone.config.pojo.CacheClusterConfig;
+import org.apache.inlong.sort.standalone.metrics.SortMetricItem;
+import org.apache.inlong.sort.standalone.metrics.audit.AuditUtils;
+import org.apache.inlong.sort.standalone.utils.Constants;
+import org.apache.inlong.sort.standalone.utils.InlongLoggerFactory;
+import org.apache.kafka.clients.producer.KafkaProducer;
+import org.apache.kafka.clients.producer.ProducerConfig;
+import org.apache.kafka.clients.producer.ProducerRecord;
+import org.apache.kafka.common.serialization.ByteArraySerializer;
+import org.apache.kafka.common.serialization.StringSerializer;
+import org.apache.pulsar.shade.org.apache.commons.lang.math.NumberUtils;
+import org.slf4j.Logger;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/** wrapper of kafka producer */
+public class KafkaProducerCluster implements LifecycleAware {
+    public static final Logger LOG = InlongLoggerFactory.getLogger(KafkaProducerCluster.class);
+
+    private static final String KEY_RETRIES = "retries";
+    private static final String KEY_ACKS = "acks";
+    private static final String KEY_BATCH_SIZE = "batch.size";
+    private static final String KEY_LINGER_MS = "linger.ms";
+    private static final String KEY_MAX_REQUEST_SIZE = "max.request.size";
+    private static final String KEY_BUFFER_MEMORY = "buffer.memory";
+    private static final String KEY_RECEIVE_BUFFER_BYTES = "receive.buffer.bytes";
+    private static final String KEY_SEND_BUFFER_BYTES = "send.buffer.bytes";
+    private static final String KEY_METADATA_FETCH_TIMEOUT_MS = "metadata.fetch.timeout.ms";
+    private static final String KEY_METADATA_MAX_AGE_MS = "metadata.max.age.ms";
+    private static final String KEY_COMPRESSION_TYPE = "compression.type";
+    private static final String KEY_MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION =
+            "max.in.flight.requests.per.connection";
+    private static final String KEY_TIMEOUT_MS = "rpc.timeout.ms";
+    private static final String KEY_DELIVERY_TIMEOUT_MS = "delivery.timeout.ms";
+    private static final String KEY_REQUEST_TIMEOUT_MS = "request.timeout.ms";
+    private static final String KEY_ENABLE_REPLACE_PARTITION_FOR_NOT_LEADER =
+            "enable.replace.partition.for.not.leader";
+    private static final String KEY_ENABLE_REPLACE_PARTITION_FOR_CAN_RETRY =
+            "enable.replace.partition.for.can.retry";
+    private static final String KEY_ENABLE_TOPIC_PARTITION_CIRCUIT_BREAKER =
+            "enable.topic.partition.circuit.breaker";
+    private static final String KEY_MUTE_PARTITION_ERROR_MAX_TIMES =
+            "mute.partition.error.max.times";
+    private static final String KEY_MUTE_PARTITION_MAX_PERCENTAGE = "mute.partition.max.percentage";
+    private static final String KEY_UNMUTE_PARTITION_INTERVAL_MS = "unmute.partition.interval.ms";
+    private static final String KEY_MAX_BLOCK_MS = "max.block.ms";

Review comment:
       unusable constant variables.

##########
File path: inlong-sort-standalone/pom.xml
##########
@@ -43,14 +43,14 @@
         <flume.version>1.9.0</flume.version>
         <plugin.assembly.version>3.2.0</plugin.assembly.version>
         <pulsar.version>2.7.2</pulsar.version>
+        <kafka.version>2.4.1</kafka.version>
         <junit.version>4.13</junit.version>
         <powermock.version>2.0.2</powermock.version>
         <guava.version>19.0</guava.version>
         <skipTests>false</skipTests>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <compiler.source>1.8</compiler.source>
         <compiler.target>1.8</compiler.target>
-        <pulsar.version>2.7.2</pulsar.version>

Review comment:
       wrong removing operation
   <pulsar.version>2.7.2</pulsar.version>




-- 
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



[GitHub] [incubator-inlong] imvan commented on a change in pull request #2359: [INLONG-1896][Feature][Sort] Inlong-Sort-Standalone support to sort the events to Kafka clusters.

Posted by GitBox <gi...@apache.org>.
imvan commented on a change in pull request #2359:
URL: https://github.com/apache/incubator-inlong/pull/2359#discussion_r803260011



##########
File path: inlong-sort-standalone/sort-standalone-source/src/main/java/org/apache/inlong/sort/standalone/sink/kafka/KafkaFederationWorker.java
##########
@@ -0,0 +1,155 @@
+/**
+ * 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.kafka;
+
+import com.google.common.base.Preconditions;
+import org.apache.flume.Channel;
+import org.apache.flume.Event;
+import org.apache.flume.Transaction;
+import org.apache.flume.lifecycle.LifecycleState;
+import org.apache.inlong.sort.standalone.channel.ProfileEvent;
+import org.apache.inlong.sort.standalone.config.pojo.InlongId;
+import org.apache.inlong.sort.standalone.metrics.SortMetricItem;
+import org.apache.inlong.sort.standalone.utils.Constants;
+import org.apache.inlong.sort.standalone.utils.InlongLoggerFactory;
+import org.apache.pulsar.shade.org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class KafkaFederationWorker extends Thread {
+    public static final Logger LOG = InlongLoggerFactory.getLogger(KafkaFederationWorker.class);
+
+    private final String workerName;
+    private final KafkaFederationSinkContext context;
+
+    private KafkaProducerFederation producerFederation;
+    private LifecycleState status;
+    private Map<String, String> dimensions = new ConcurrentHashMap<>();
+
+    /**
+     * constructor of KafkaFederationWorker
+     *
+     * @param sinkName
+     * @param workerIndex
+     * @param context
+     */
+    public KafkaFederationWorker(
+            String sinkName, int workerIndex, KafkaFederationSinkContext context) {
+        super();
+        this.workerName = sinkName + "-" + workerIndex;
+        this.context = Preconditions.checkNotNull(context);
+        this.producerFederation =
+                new KafkaProducerFederation(String.valueOf(workerIndex), this.context);
+        this.status = LifecycleState.IDLE;
+        this.dimensions.put(SortMetricItem.KEY_CLUSTER_ID, this.context.getClusterId());
+        this.dimensions.put(SortMetricItem.KEY_TASK_NAME, this.context.getTaskName());
+        this.dimensions.put(SortMetricItem.KEY_SINK_ID, this.context.getSinkName());
+    }
+
+    /** entrance of KafkaFederationWorker */
+    @Override
+    public void start() {
+        LOG.info("start a new kafka worker {}", this.workerName);
+        this.producerFederation.start();
+        this.status = LifecycleState.START;
+        super.start();
+    }
+
+    /** close */
+    public void close() {
+        // close all producers
+        LOG.info("close a kafka worker {}", this.workerName);
+        this.producerFederation.close();
+        this.status = LifecycleState.STOP;
+    }
+
+    @Override
+    public void run() {
+        LOG.info("worker {} start to run, the state is {}", this.workerName, status.name());
+        while (status != LifecycleState.STOP) {
+            Transaction tx = null;
+            try {
+                Channel channel = context.getChannel();
+                if (channel == null) {
+                    LOG.error("in kafka worker, channel is null ");
+                    break;
+                }
+                tx = channel.getTransaction();
+                tx.begin();
+                Event rowEvent = channel.take();
+                if (rowEvent == null) {
+                    tx.commit();
+                    tx.close();
+                    sleepOneInterval();
+                    continue;
+                }
+                ProfileEvent event = (ProfileEvent) rowEvent;
+                this.fillTopic(event);
+                SortMetricItem.fillInlongId(event, dimensions);
+                this.dimensions.put(
+                        SortMetricItem.KEY_SINK_DATA_ID, event.getHeaders().get(Constants.TOPIC));
+                long msgTime = event.getRawLogTime();
+                long auditFormatTime = msgTime - msgTime % 60000L;

Review comment:
       fixed




-- 
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



[GitHub] [incubator-inlong] imvan commented on a change in pull request #2359: [INLONG-1896][Feature][Sort] Inlong-Sort-Standalone support to sort the events to Kafka clusters.

Posted by GitBox <gi...@apache.org>.
imvan commented on a change in pull request #2359:
URL: https://github.com/apache/incubator-inlong/pull/2359#discussion_r803257775



##########
File path: inlong-sort-standalone/pom.xml
##########
@@ -43,14 +43,14 @@
         <flume.version>1.9.0</flume.version>
         <plugin.assembly.version>3.2.0</plugin.assembly.version>
         <pulsar.version>2.7.2</pulsar.version>
+        <kafka.version>2.4.1</kafka.version>
         <junit.version>4.13</junit.version>
         <powermock.version>2.0.2</powermock.version>
         <guava.version>19.0</guava.version>
         <skipTests>false</skipTests>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <compiler.source>1.8</compiler.source>
         <compiler.target>1.8</compiler.target>
-        <pulsar.version>2.7.2</pulsar.version>

Review comment:
       ![image](https://user-images.githubusercontent.com/45282474/153327428-1843f708-9d12-450c-9249-9051062e5bef.png)
   There were two defination of pulsar version, so I remove one of them. 
   And just fixex it to version 2.8.1




-- 
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



[GitHub] [incubator-inlong] imvan commented on a change in pull request #2359: [INLONG-1896][Feature][Sort] Inlong-Sort-Standalone support to sort the events to Kafka clusters.

Posted by GitBox <gi...@apache.org>.
imvan commented on a change in pull request #2359:
URL: https://github.com/apache/incubator-inlong/pull/2359#discussion_r803257775



##########
File path: inlong-sort-standalone/pom.xml
##########
@@ -43,14 +43,14 @@
         <flume.version>1.9.0</flume.version>
         <plugin.assembly.version>3.2.0</plugin.assembly.version>
         <pulsar.version>2.7.2</pulsar.version>
+        <kafka.version>2.4.1</kafka.version>
         <junit.version>4.13</junit.version>
         <powermock.version>2.0.2</powermock.version>
         <guava.version>19.0</guava.version>
         <skipTests>false</skipTests>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <compiler.source>1.8</compiler.source>
         <compiler.target>1.8</compiler.target>
-        <pulsar.version>2.7.2</pulsar.version>

Review comment:
       ![image](https://user-images.githubusercontent.com/45282474/153327428-1843f708-9d12-450c-9249-9051062e5bef.png)
   There were two definitions of pulsar version, so I removed one of them. 
   And just fixex it to version 2.8.1




-- 
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