AE86 2 سال پیش
والد
کامیت
430761c33d

+ 0 - 43
dbsyncer-web/src/main/java/org/dbsyncer/web/config/OpenApiConfig.java

@@ -1,43 +0,0 @@
-package org.dbsyncer.web.config;
-
-import org.dbsyncer.web.remote.UserService;
-import org.dbsyncer.web.remote.UserServiceImpl;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
-import org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter;
-
-/**
- * @author AE86
- * @version 1.0.0
- * @date 2019/9/10 23:07
- */
-@Configuration
-public class OpenApiConfig {
-
-    /**
-     * 发布服务接口
-     * @return
-     */
-    @Bean("/remoteService")
-    public HttpInvokerServiceExporter remoteService() {
-        HttpInvokerServiceExporter httpInvokerServiceExporter = new HttpInvokerServiceExporter();
-        httpInvokerServiceExporter.setService(new UserServiceImpl());
-        httpInvokerServiceExporter.setServiceInterface(UserService.class);
-        return httpInvokerServiceExporter;
-    }
-
-    /**
-     * 客户端,代理工厂HttpInvokerProxyFactoryBean,用于创建HttpInvoker代理来与远程服务通信
-     *
-     * @return
-     */
-    @Bean
-    public HttpInvokerProxyFactoryBean userService() {
-        HttpInvokerProxyFactoryBean proxy = new HttpInvokerProxyFactoryBean();
-        proxy.setServiceUrl("http://localhost:18686/userService");
-        proxy.setServiceInterface(UserService.class);
-        return proxy;
-    }
-
-}

+ 15 - 17
dbsyncer-web/src/main/java/org/dbsyncer/web/controller/TestController.java

@@ -1,13 +1,10 @@
 package org.dbsyncer.web.controller;
 
-import org.dbsyncer.biz.MappingService;
 import org.dbsyncer.common.util.RandomUtil;
 import org.dbsyncer.common.util.StringUtil;
-import org.dbsyncer.web.remote.UserService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationContext;
 import org.springframework.core.DefaultParameterNameDiscoverer;
 import org.springframework.core.ParameterNameDiscoverer;
@@ -27,9 +24,14 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
 import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
 import org.springframework.web.servlet.support.RequestContextUtils;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 @Controller
@@ -38,11 +40,16 @@ public class TestController implements InitializingBean {
 
     private final Logger logger = LoggerFactory.getLogger(getClass());
 
-    @Autowired
-    private UserService userService;
+    @Resource
+    private RequestMappingHandlerAdapter requestMappingHandlerAdapter;
+
+    @Resource
+    private ApplicationContext applicationContext;
 
-    @Autowired
-    private MappingService mappingService;
+    private Map<String, String> parsePackage = new HashMap<>();
+    private Map<String, InvocableHandlerMethod> handlers = new ConcurrentHashMap<>();
+    private HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite();
+    private ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
 
     @ResponseBody
     @RequestMapping("/demo")
@@ -84,15 +91,6 @@ public class TestController implements InitializingBean {
         return null;
     }
 
-    @Autowired
-    private RequestMappingHandlerAdapter requestMappingHandlerAdapter;
-    @Autowired
-    private ApplicationContext applicationContext;
-    private Map<String, String> parsePackage = new HashMap<>();
-    private Map<String, InvocableHandlerMethod> handlers = new ConcurrentHashMap<>();
-    private HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite();
-    private ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
-
     @Override
     public void afterPropertiesSet() {
         // 初始化拦截mapping

+ 27 - 27
dbsyncer-web/src/main/resources/application.properties

@@ -18,15 +18,26 @@ dbsyncer.web.task.executor.core-size=10
 # 同步任务线程池队列
 dbsyncer.web.task.executor.queue-capacity=1000
 
+#storage
+# 是否使用MySQL存储配置(false-关闭; true-开启)
+# false: 保存磁盘/data/{binlog(同步任务)|config(驱动配置)|data(按驱动分别存储增量数据)|log(系统日志)}
+dbsyncer.storage.support.mysql.enabled=false
+dbsyncer.storage.support.mysql.config.url=jdbc:mysql://127.0.0.1:3306/dbsyncer?rewriteBatchedStatements=true&seUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai&useSSL=false&verifyServerCertificate=false&autoReconnect=true
+dbsyncer.storage.support.mysql.config.username=root
+dbsyncer.storage.support.mysql.config.password=123
+# binlog指持久化增量数据到磁盘的任务
+# 从磁盘批量读取的任务数
+dbsyncer.storage.binlog.recorder.batch-count=10000
+# 最长处理时间(秒),在限定的时间内提交的任务没有被成功消费,将会重复执行
+dbsyncer.storage.binlog.recorder.max-processing-seconds=120
+# 任务队列容量
+dbsyncer.storage.binlog.recorder.queue-capacity=10000
+# 写磁盘间隔(毫秒)
+dbsyncer.storage.binlog.recorder.writer-period-millisecond=500
+# 读磁盘间隔(毫秒)
+dbsyncer.storage.binlog.recorder.reader-period-millisecond=2000
+
 #parser
-# 是否记录全量数据(false-关闭; true-开启)
-dbsyncer.parser.flush.data.full.enabled=false
-# 是否记录同步成功数据(false-关闭; true-开启)
-dbsyncer.parser.flush.data.writer-success=true
-# 是否记录同步失败数据(false-关闭; true-开启)
-dbsyncer.parser.flush.data.writer-fail=true
-# 记录同步失败日志最大长度
-dbsyncer.parser.flush.data.max-error-length=2048
 # 是否缓存同步任务。(false-关闭; true-开启)
 # true: 不优先持久化磁盘,同步效率高,缓存队列溢出也会将持久化磁盘,可能丢失任务;
 # false: 先持久化到磁盘,同步效率低,定时从磁盘读取任务到缓存队列,不会丢失任务。
@@ -39,6 +50,14 @@ dbsyncer.parser.flush.buffer.actuator.batch-count=1000
 dbsyncer.parser.flush.buffer.actuator.queue-capacity=100000
 # 定时消费缓存队列间隔(毫秒)
 dbsyncer.parser.flush.buffer.actuator.period-millisecond=300
+# 是否记录全量数据(false-关闭; true-开启)
+dbsyncer.parser.flush.data.full.enabled=false
+# 是否记录同步成功数据(false-关闭; true-开启)
+dbsyncer.parser.flush.data.writer-success=true
+# 是否记录同步失败数据(false-关闭; true-开启)
+dbsyncer.parser.flush.data.writer-fail=true
+# 记录同步失败日志最大长度
+dbsyncer.parser.flush.data.max-error-length=2048
 
 #plugin
 # 是否开启邮箱通知功能(false-关闭; true-开启)
@@ -50,25 +69,6 @@ dbsyncer.plugin.notify.mail.username=your mail username
 # 发邮件的Code(注:不是邮箱密码),示例:wqoxxxxxxdflbbig
 dbsyncer.plugin.notify.mail.password=your mail authorization code
 
-#storage
-# binlog:指将增量任务持久化写到磁盘的任务
-# 从磁盘批量读取的任务数
-dbsyncer.storage.binlog.recorder.batch-count=10000
-# 最长处理时间(秒),在限定的时间内提交的任务没有被成功消费,将会重复执行
-dbsyncer.storage.binlog.recorder.max-processing-seconds=120
-# 任务队列容量
-dbsyncer.storage.binlog.recorder.queue-capacity=10000
-# 写磁盘间隔(毫秒)
-dbsyncer.storage.binlog.recorder.writer-period-millisecond=500
-# 读磁盘间隔(毫秒)
-dbsyncer.storage.binlog.recorder.reader-period-millisecond=2000
-# 是否使用MySQL存储配置(false-关闭; true-开启)
-# false: 保存磁盘/data/{binlog(同步任务)|config(驱动配置)|data(按驱动分别存储增量数据)|log(系统日志)}
-dbsyncer.storage.support.mysql.enabled=false
-dbsyncer.storage.support.mysql.config.url=jdbc:mysql://127.0.0.1:3306/dbsyncer?rewriteBatchedStatements=true&seUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai&useSSL=false&verifyServerCertificate=false&autoReconnect=true
-dbsyncer.storage.support.mysql.config.username=root
-dbsyncer.storage.support.mysql.config.password=123
-
 #monitor
 management.endpoints.web.base-path=/app
 management.endpoints.web.exposure.include=*