| | |
| | | import java.util.stream.Collectors;
|
| | |
|
| | | /**
|
| | | * 登记员
|
| | | * @author wuqiong 2022/4/11
|
| | | * @description
|
| | | */
|
| | | public class CanalListenerEndpointRegistrar {
|
| | |
|
| | | private Object bean;
|
| | | private Map.Entry<Method, CanalListener> listenerEntry;
|
| | |
|
| | | /**
|
| | | * 1、目前实现的 DML 解析器仅支持两个参数 <p>
|
| | | * 2、且顺序必须为: CanalEntry.EventType 、 CanalEntry.RowData <p>
|
| | | * 3、如果CanalListener 指定的 destination 不在配置文件内,则直接抛错 <p>
|
| | | * @param sets
|
| | | * @return void
|
| | | * @author wuqiong 2022-04-23 20:27
|
| | | */
|
| | | public void checkParameter(Set<String> sets) {
|
| | | List<Class<?>> classes = parameterTypes();
|
| | | if (classes.size() > 2
|
| | |
| | | return getListenerEntry().getValue().destination().equals(destination);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 过滤参数
|
| | | * @param database
|
| | | * @param tableName
|
| | | * @param eventType
|
| | | * @return java.util.function.Predicate
|
| | | * @author wuqiong 2022-04-23 20:47
|
| | | */
|
| | | public static Predicate<CanalListenerEndpointRegistrar> filterArgs(
|
| | | String database, String tableName, CanalEntry.EventType eventType) {
|
| | | Predicate<CanalListenerEndpointRegistrar> databases = e -> StringUtils.isBlank(e.getListenerEntry().getValue().database())
|