normangyllenhaal / canal-client Goto Github PK
View Code? Open in Web Editor NEWspring boot canal starter 易用的canal 客户端 canal client
spring boot canal starter 易用的canal 客户端 canal client
1、对非纯字母的字段值实体映射时,属性值为空。如包含"_"的字段,属性名为驼峰;
2、ORM实体属性不支持LocalDateTime;
@Override
<R> R newInstance(Class<R> c, List<CanalEntry.Column> columns) throws Exception {
R object = c.newInstance();
Map<String, String> columnNames = EntryUtil.getFieldName(object.getClass());
for (CanalEntry.Column column : columns) {
String fieldName = columnNames.get(column.getName());
if (StringUtils.isNotEmpty(fieldName)) {
FieldUtil.setFieldValue(object, fieldName, column.getValue());
}
}
return object;
}
static Object convertType(Class<?> type, String columnValue) {
if(columnValue==null){
return null;
}else if (type.equals(Integer.class)) {
return Integer.parseInt(columnValue);
} else if (type.equals(Long.class)) {
return Long.parseLong(columnValue);
} else if (type.equals(Boolean.class)) {
return convertToBoolean(columnValue);
} else if (type.equals(BigDecimal.class)) {
return new BigDecimal(columnValue);
} else if (type.equals(Double.class)) {
return Double.parseDouble(columnValue);
} else if (type.equals(Float.class)) {
return Float.parseFloat(columnValue);
} else if (type.equals(Date.class)) {
return parseDate(columnValue);
} else if (type.equals(java.sql.Date.class)) {
return parseDate(columnValue);
} else {
return columnValue;
}
}
sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
mysql使用枚举字段,在Java实体类加注解 @Enumerated(EnumType.STRING),canal报错
StringConvertUtil类用对数据进行转换时,应该加上对长度的校验
首先感谢原作者的项目
目前我在原版的基础上新增了部分功能,canal-client进行了升级,且修复了此项目中提到的issue
在此贴下地址:https://github.com/behappy-project/behappy-canal
如果有感兴趣一起完善的可以联系我
1.字段日期类型不全面,YYYY-MM-dd hh:mm:ss.SSS 等格式无法转换,目前只能使用string类型接收
2.canal.asyncs设置为false不生效,启动会报错,原因:同一个类中2个MessageHandler用同样的methodname,@bean注解应该只会按照方法名注入第一个bean. 换用不同方法名即可
3.版本1.2.6目前无法下载
没有“”判断
是否支持多个数据库:
@CanalTable(value = "t_user")只支持单库,当多个库中都有t_user这个表的时候均会进入同一个EntryHandler,不知道有没有根据数据库和数据表一起做条件匹配EntryHandler的方法?
比如Java中使用Integer、Long、BigDecimal等类型的字段,数据表中字段的值为null,canal就会报错:For input string ""
因为源码里面,值为Null的数字类型字段直接变成了空字符串,所以报这个错误
数据的增删是否支持批量的操作
INFO 5324 --- [l-client-thread] t.j.c.client.client.AbstractCanalClient : 获取消息 Message[id=9732,entries=[header {
version: 1
logfileName: "mysql-bin.000092"
logfileOffset: 40795484
serverId: 12345
serverenCode: "UTF-8"
executeTime: 1565505699000
sourceType: MYSQL
schemaName: "changgou_goods"
tableName: "tb_sku"
eventLength: 6592
eventType: UPDATE
props {
key: "rowsCount"
value: "4"
}
}
entryType: ROWDATA
top.javatool.canal.client.annotation.CanalTable 此注解,在数据库表名不规范时监听不到
例:
错误 table : T_TxxxxxxInfo
正确 table : t_txxxx_info
以后使用可以注意下,或者作者可以优化下
当mysql 开启事务的时候 。 写入多表 多数据 。这边能相应到 但是 是循环返回的 , 能不能一次性返回 。不做多次返回
开发环境 win7
canal 环境 1.3
服务器 windows12
mysql 5.7
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.