From c83c1b4ee7ff9c01a7a67855863c281589f39c72 Mon Sep 17 00:00:00 2001 From: duxinglangzi <871364441@qq.com> Date: 星期一, 15 八月 2022 19:58:57 +0800 Subject: [PATCH] 修改了listener方法的参数 --- src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerEndpointRegistrar.java | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerEndpointRegistrar.java b/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerEndpointRegistrar.java index c9e0c1d..ad778bc 100644 --- a/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerEndpointRegistrar.java +++ b/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerEndpointRegistrar.java @@ -2,6 +2,7 @@ import com.alibaba.otter.canal.protocol.CanalEntry; import com.alibaba.otter.canal.protocol.exception.CanalClientException; +import com.duxinglangzi.canal.starter.mode.CanalMessage; import org.apache.commons.lang3.StringUtils; import java.lang.reflect.Method; @@ -12,7 +13,7 @@ import java.util.stream.Collectors; /** - * 鐧昏鍛� + * 鐩戝惉鐨勭粓绔敞鍐屽櫒 * * @author wuqiong 2022/4/11 */ @@ -42,8 +43,8 @@ private CanalEntry.EventType[] eventType; /** - * 1銆佺洰鍓嶅疄鐜扮殑 DML 瑙f瀽鍣ㄤ粎鏀寔涓や釜鍙傛暟 <p> - * 2銆佷笖椤哄簭蹇呴』涓�: CanalEntry.EventType 銆� CanalEntry.RowData <p> + * 1銆佺洰鍓嶅疄鐜扮殑 DML 瑙f瀽鍣ㄤ粎鏀寔1涓弬鏁�, 璇ュ弬鏁板璞″唴鍖呭惈浜�: 搴撳悕銆佽〃鍚嶃�佷簨浠剁被鍨嬨�佸彉鏇寸殑鏁版嵁 <p> + * 2銆佹柟娉曞弬鏁板繀椤讳负: CanalMessage <p> * 3銆佸鏋淐analListener 鎸囧畾鐨� destination 涓嶅湪閰嶇疆鏂囦欢鍐咃紝鍒欑洿鎺ユ姏閿� <p> * * @param sets @@ -52,11 +53,9 @@ */ public void checkParameter(Set<String> sets) { List<Class<?>> classes = parameterTypes(); - if (classes.size() > 2 - || classes.get(1) != CanalEntry.RowData.class - || classes.get(0) != CanalEntry.EventType.class) + if (classes.size() != 1 || classes.get(0) != CanalMessage.class) throw new IllegalArgumentException("@CanalListener Method Parameter Type Invalid, " + - "Need Parameter Type [CanalEntry.EventType,CanalEntry.RowData] please check "); + "Need Parameter Type [ com.duxinglangzi.canal.starter.mode.CanalMessage ] please check "); if (StringUtils.isNotBlank(getDestination()) && !sets.contains(getDestination())) throw new CanalClientException("@CanalListener Illegal destination , please check "); -- Gitblit v1.8.0