Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INLONG-1891] Inlong-Sort-Standalone add sort-standalone-source module. #1930

Merged
merged 1 commit into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions inlong-sort-standalone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<plugin.assembly.version>3.2.0</plugin.assembly.version>
<pulsar.version>2.7.2</pulsar.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>
Expand Down Expand Up @@ -85,13 +86,13 @@
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>2.0.2</version>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.2</version>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
28 changes: 18 additions & 10 deletions inlong-sort-standalone/sort-standalone-common/pom.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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. -->
<!--
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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ private static SortClusterConfigHolder get() {
}
} catch (Throwable t) {
LOG.error("Fail to init loader,loaderType:{},error:{}", loaderType, t.getMessage());
LOG.error(t.getMessage(), t);
}
if (instance.loader == null) {
instance.loader = new ClassResourceSortClusterConfigLoader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,112 +104,4 @@ public SortClusterConfig getData() {
public void setData(SortClusterConfig data) {
this.data = data;
}
//
// /**
// * generateTdbankConfig
// *
// * @return
// */
// public static SortClusterConfig generateTdbankConfig() {
// SortClusterConfig clusterConfig = new SortClusterConfig();
// clusterConfig.setClusterName("tdbankv3-sz-sz1");
// //
// List<SortTaskConfig> sortTasks = new ArrayList<>();
// clusterConfig.setSortTasks(sortTasks);
// SortTaskConfig taskConfig = new SortTaskConfig();
// sortTasks.add(taskConfig);
// taskConfig.setName("sid_tdbank_atta6th_v3");
// taskConfig.setType(SortType.TQTDBANK);
// //
// Map<String, String> sinkParams = new HashMap<>();
// taskConfig.setSinkParams(sinkParams);
// sinkParams.put("b_pcg_venus_szrecone_124_153_utf8", "10.56.15.195:46801,10.56.15.212:46801,"
// + "10.56.15.220:46801,10.56.15.221:46801,"
// + "10.56.15.230:46801,10.56.16.20:46801,10.56.16.38:46801,10.56.20.21:46801,10.56.20.80:46801,"
// + "10.56.20.85:46801,10.56.209.205:46801,10.56.21.17:46801,10.56.21.20:46801,10.56.21.79:46801,"
// + "10.56.21.85:46801,10.56.81.205:46801,10.56.81.211:46801,10.56.82.11:46801,10.56.82.12:46801,"
// + "10.56.82.37:46801,10.56.82.38:46801,10.56.82.40:46801,10.56.83.143:46801,10.56.83.80:46801,"
// + "10.56.84.17:46801");
// //
// List<Map<String, String>> idParams = new ArrayList<>();
// Map<String, String> idParam = new HashMap<>();
// idParams.add(idParam);
// taskConfig.setIdParams(idParams);
// idParam.put(Constants.INLONG_GROUP_ID, "0fc00000046");
// idParam.put(Constants.INLONG_STREAM_ID, "");
// idParam.put(TdbankConfig.KEY_BID, "b_pcg_venus_szrecone_124_153_utf8");
// idParam.put(TdbankConfig.KEY_TID, "t_sh_atta_v2_0fc00000046");
// idParam.put(TdbankConfig.KEY_DATA_TYPE, TdbankConfig.DATA_TYPE_ATTA_TEXT);
// return clusterConfig;
// }
//
// /**
// * generateCdmqConfig
// *
// * @return
// */
// public static SortClusterConfig generateCdmqConfig() {
// SortClusterConfig clusterConfig = new SortClusterConfig();
// clusterConfig.setClusterName("cdmqv3-sz-sz1");
// //
// List<SortTaskConfig> sortTasks = new ArrayList<>();
// clusterConfig.setSortTasks(sortTasks);
// SortTaskConfig taskConfig = new SortTaskConfig();
// sortTasks.add(taskConfig);
// taskConfig.setName("sid_cdmq_kg_videorequest_v3");
// taskConfig.setType(SortType.CDMQ);
// //
// Map<String, String> sinkParams = new HashMap<>();
// taskConfig.setSinkParams(sinkParams);
// sinkParams.put("cdmqAccessPoint", "cdmqszentry01.data.mig:10005,cdmqszentry05.data.mig:10033");
// sinkParams.put("cdmqClusterId", "kg_videorequest");
// sinkParams.put("clientId", "p_video_atta_196");
// sinkParams.put("batchSize", "122880");
// sinkParams.put("maxRequestSize", "8388608");
// sinkParams.put("lingerMs", "150");
// //
// List<Map<String, String>> idParams = new ArrayList<>();
// Map<String, String> idParam = new HashMap<>();
// idParams.add(idParam);
// taskConfig.setIdParams(idParams);
// idParam.put(Constants.INLONG_GROUP_ID, "0fc00000046");
// idParam.put(Constants.TOPIC, "U_TOPIC_0fc00000046");
// return clusterConfig;
// }
//
// /**
// * main
// *
// * @param args
// */
// public static void main(String[] args) {
// // tdbank
// {
// SortClusterConfig config = generateTdbankConfig();
// String configString = JSON.toJSONString(config, false);
// System.out.println("tdbank:" + configString);
// String md5 = DigestUtils.md5Hex(configString);
// SortClusterResponse response = new SortClusterResponse();
// response.setResult(true);
// response.setErrCode(SUCC);
// response.setMd5(md5);
// response.setData(config);
// String responseString = JSON.toJSONString(response, true);
// System.out.println("tdbank responseString:" + responseString);
// }
// // cdmq
// {
// SortClusterConfig config = generateCdmqConfig();
// String configString = JSON.toJSONString(config, false);
// System.out.println("cdmq:" + configString);
// String md5 = DigestUtils.md5Hex(configString);
// SortClusterResponse response = new SortClusterResponse();
// response.setResult(true);
// response.setErrCode(SUCC);
// response.setMd5(md5);
// response.setData(config);
// String responseString = JSON.toJSONString(response, true);
// System.out.println("cdmq responseString:" + responseString);
// }
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
public enum CacheType {

TUBE("tube"), KAFKA("kafka"), PULSAR("pulsar"), N("n");
TUBE("tube"), KAFKA("kafka"), PULSAR("pulsar"), UNKNOWN("n");

private final String value;

Expand Down Expand Up @@ -65,6 +65,6 @@ public static CacheType convert(String value) {
return v;
}
}
return N;
return UNKNOWN;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
public enum DataType {

TEXT("text"), PB("pb"), JCE("jce"), N("n");
TEXT("text"), PB("pb"), JCE("jce"), UNKNOWN("n");

private final String value;

Expand Down Expand Up @@ -65,6 +65,6 @@ public static DataType convert(String value) {
return v;
}
}
return N;
return UNKNOWN;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public enum SortType {

HIVE("hive"), TUBE("tube"), KAFKA("kafka"), PULSAR("pulsar"), ElasticSearch("ElasticSearch"), THTDBANK(
"thtdbank"), TQTDBANK("tqtdbank"), CDMQ("cdmq"), N("n");
"thtdbank"), TQTDBANK("tqtdbank"), CDMQ("cdmq"), UNKNOWN("n");

private final String value;

Expand Down Expand Up @@ -67,6 +67,6 @@ public static SortType convert(String value) {
return v;
}
}
return N;
return UNKNOWN;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,4 @@ public static String getClassNamePrefix(String className, int layer) {
String namePrefix = className.substring(0, index);
return namePrefix;
}

// /**
// * main
// * @param args
// */
// public static void main(String[] args) {
// int layer = 3;
// String className = "";
// System.out.println(className + ":" + getClassNamePrefix(className, layer));
// className = "ccc";
// System.out.println(className + ":" + getClassNamePrefix(className, layer));
// className = "org.ccc";
// System.out.println(className + ":" + getClassNamePrefix(className, layer));
// className = "org.apache.ccc";
// System.out.println(className + ":" + getClassNamePrefix(className, layer));
// className = "org.apache.inlong.ccc";
// System.out.println(className + ":" + getClassNamePrefix(className, layer));
// className = "org.apache.inlong.sort.ccc";
// System.out.println(className + ":" + getClassNamePrefix(className, layer));
// className = "org.apache.inlong.sort.standalone.ccc";
// System.out.println(className + ":" + getClassNamePrefix(className, layer));
// }
}
55 changes: 21 additions & 34 deletions inlong-sort-standalone/sort-standalone-source/pom.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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. -->
<!--
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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -26,34 +34,13 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.source>1.8</compiler.source>
<compiler.target>1.8</compiler.target>
<junit.version>4.13</junit.version>
<guava.version>19.0</guava.version>
<skipTests>false</skipTests>
</properties>

<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
<groupId>org.apache.inlong</groupId>
<artifactId>sort-standalone-common</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* 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;

import java.util.HashMap;
import java.util.Map;

import org.apache.flume.conf.FlumeConfiguration;
import org.apache.flume.node.AbstractConfigurationProvider;
import org.slf4j.Logger;
import org.apache.inlong.sort.standalone.utils.InlongLoggerFactory;

/**
*
* PropertiesConfigurationProvider
*/
public class PropertiesConfigurationProvider extends
AbstractConfigurationProvider {

public static final Logger LOG = InlongLoggerFactory.getLogger(PropertiesConfigurationProvider.class);

private final Map<String, String> flumeConf;

/**
* PropertiesConfigurationProvider
*
* @param agentName
* @param flumeConf
*/
public PropertiesConfigurationProvider(String agentName, Map<String, String> flumeConf) {
super(agentName);
this.flumeConf = flumeConf;
}

/**
* getFlumeConfiguration
*
* @return
*/
@Override
public FlumeConfiguration getFlumeConfiguration() {
try {
return new FlumeConfiguration(flumeConf);
} catch (Exception e) {
LOG.error("exception catch:" + e.getMessage(), e);
}
return new FlumeConfiguration(new HashMap<String, String>());
}
}
Loading