MCPcopy Index your code
hub / github.com/eastzq/simpledatax-service

github.com/eastzq/simpledatax-service @v1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.0 ↗ · + Follow
1,733 symbols 4,891 edges 207 files 218 documented · 13% updated 3y ago★ 38
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

关于simpledatax

背景

simpledatax基于阿里开源数据采集工具datax做了一些减法,适合特定的场景。关于阿里的datax请移步 https://github.com/alibaba/DataX

改动说明

  1. 将datax进程调用改为线程内调用。修复初始化时实例之间的冲突。
  2. 将插件包和调度包集成到同一个包内,方便修改。
  3. 插件间不再使用不同的类加载器。插件预加载机制。同时不改变参数的json配置处理机制。
  4. 新增参数对象作为入参,封装接口,提取关键参数用于配置。
  5. 修改内部调度机制,移除sleep收集任务执行状态的机制,修改为各个任务执行完毕时汇报情况,使用Future获取返回结果,可以稍微提高下效率。
  6. 新增返回调度结果实例。用于界面展现。
  7. 移除TaskGroupContainer,只能单机使用,如果需要集群建议结合分布式服务框架使用。
  8. 调整了信息汇报部分代码,目前来看更加直观,也更易于修改。

文档说明

  1. 请参考阿里各个插件的文档。如果有更新需要替换插件并调整下代码。

调用示例

public static void main(String[] args) throws DxException {
    DataCollectJob job = new DataCollectJob();
    job.setJobId(1);
    job.setChannelNum(2);
    MySqlReader reader = new MySqlReader();
    reader.setDbIp("192.168.0.120");
    reader.setDbPort("3306");
    reader.setDbInstanceName("test");
    reader.setSplitPk("COL1");
    reader.setDbUser("root");
    reader.setDbPassword("root");
    reader.setTableName("mysql_load_test");
    reader.setColumnStrs("COL1,COL2,COL3,COL4");
    job.setReader(reader);

    MySqlWriter writer = new MySqlWriter();
    writer.setDbIp("192.168.0.121");
    writer.setDbPort("3306");
    writer.setDbUser("root");
    writer.setDbPassword("root");
    writer.setTableName("mysql_load_test1");
    writer.setColumnStrs("COL1,COL2,COL3,COL4");
    writer.setDbInstanceName("test");
    job.setWriter(writer);
    DxService service = new DxService();
    DataCollectResult result = service.collect(job);
    System.out.println(JSON.toJSONString(result)); 
}

下一步方向

  • [x] 去除配置项的class类和代码里的全类名。
  • [x] 新增定时报告打印。
  • [ ] 新增分片api。
  • [ ] 新增执行任务时支持以单一分片执行任务。
  • [ ] 新增终止采集api。

Extension points exported contracts — how you extend this code

ErrorCode (Interface)
尤其注意:最好提供toString()实现。例如: @Override public String toString() { return String.format("Code:[%s], Descr [17 implementers]
src/main/java/com/github/simpledatax/common/spi/ErrorCode.java
Record (Interface)
Created by jingxing on 14-8-24. [5 implementers]
src/main/java/com/github/simpledatax/common/element/Record.java
Parser (Interface)
(no doc) [6 implementers]
src/main/java/com/github/simpledatax/api/adaptor/parser/intf/Parser.java
RecordReceiver (Interface)
(no doc) [6 implementers]
src/main/java/com/github/simpledatax/common/plugin/RecordReceiver.java
RecordSender (Interface)
(no doc) [6 implementers]
src/main/java/com/github/simpledatax/common/plugin/RecordSender.java

Core symbols most depended-on inside this repo

format
called by 461
src/main/java/com/github/simpledatax/plugin/rdbms/util/SqlFormatUtil.java
asDataXException
called by 418
src/main/java/com/github/simpledatax/common/exception/DataXException.java
getString
called by 233
src/main/java/com/github/simpledatax/common/util/Configuration.java
add
called by 148
src/main/java/com/github/simpledatax/common/statistics/PerfTrace.java
set
called by 139
src/main/java/com/github/simpledatax/common/util/Configuration.java
equals
called by 133
src/main/java/com/github/simpledatax/common/base/BaseObject.java
size
called by 121
src/main/java/com/github/simpledatax/core/transport/channel/Channel.java
get
called by 100
src/main/java/com/github/simpledatax/common/util/Configuration.java

Shape

Method 1,456
Class 228
Enum 32
Interface 17

Languages

Java100%

Modules by API surface

src/main/java/com/github/simpledatax/common/statistics/PerfTrace.java117 symbols
src/main/java/com/github/simpledatax/common/util/Configuration.java52 symbols
src/main/java/com/github/simpledatax/common/statistics/PerfRecord.java32 symbols
src/main/java/com/github/simpledatax/core/statistics/communication/CommunicationTool.java31 symbols
src/main/java/com/github/simpledatax/plugin/rdbms/util/DBUtil.java29 symbols
src/main/java/com/github/simpledatax/core/job/JobContainer.java28 symbols
src/main/java/com/github/simpledatax/common/statistics/VMInfo.java27 symbols
src/main/java/com/github/simpledatax/plugin/rdbms/writer/CommonRdbmsWriter.java26 symbols
src/main/java/com/github/simpledatax/core/transport/channel/Channel.java25 symbols
src/main/java/com/github/simpledatax/core/statistics/plugin/task/util/DirtyRecord.java24 symbols
src/main/java/com/github/simpledatax/core/statistics/communication/Communication.java23 symbols
src/main/java/com/github/simpledatax/plugin/rdbms/util/SqlFormatUtil.java22 symbols

Datastores touched

(mysql)Database · 1 repos

For agents

$ claude mcp add simpledatax-service \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page