|
@@ -1,41 +1,41 @@
|
|
|
-package com.kxs.transfer.api.config;
|
|
|
|
|
-
|
|
|
|
|
-import com.aliyun.dts.subscribe.clients.metastore.AbstractUserMetaStore;
|
|
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
-import com.kxs.transfer.api.model.KxsCheckpoint;
|
|
|
|
|
-import com.kxs.transfer.api.service.KxsCheckpointService;
|
|
|
|
|
-
|
|
|
|
|
-/**
|
|
|
|
|
- * store the checkpoint data in the shared storage, such us database, shared file storage...
|
|
|
|
|
- * this meta store need to be completed by consumer
|
|
|
|
|
- */
|
|
|
|
|
-public class UserMetaStore extends AbstractUserMetaStore {
|
|
|
|
|
-
|
|
|
|
|
- private KxsCheckpointService kxsCheckpointService;
|
|
|
|
|
-
|
|
|
|
|
- public UserMetaStore(KxsCheckpointService kxsCheckpointService) {
|
|
|
|
|
-
|
|
|
|
|
- this.kxsCheckpointService = kxsCheckpointService;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- protected void saveData(String groupID, String toStoreJson) {
|
|
|
|
|
-
|
|
|
|
|
- System.out.println("消费节点" + groupID+ "保存checkpoint数据:" + toStoreJson);
|
|
|
|
|
- KxsCheckpoint kxsCheckpoint = new KxsCheckpoint();
|
|
|
|
|
- kxsCheckpoint.setGroupId(groupID);
|
|
|
|
|
- kxsCheckpoint.setCheckpoint(toStoreJson);
|
|
|
|
|
- kxsCheckpointService.save(kxsCheckpoint);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- protected String getData(String groupID) {
|
|
|
|
|
-
|
|
|
|
|
- System.out.println("获取节点" + groupID);
|
|
|
|
|
- KxsCheckpoint checkpoint = kxsCheckpointService.getOne(Wrappers.lambdaQuery(KxsCheckpoint.class)
|
|
|
|
|
- .eq(KxsCheckpoint::getGroupId, groupID));
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- return checkpoint.getCheckpoint();
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
|
|
+//package com.kxs.transfer.api.config;
|
|
|
|
|
+//
|
|
|
|
|
+//import com.aliyun.dts.subscribe.clients.metastore.AbstractUserMetaStore;
|
|
|
|
|
+//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
+//import com.kxs.transfer.api.model.KxsCheckpoint;
|
|
|
|
|
+//import com.kxs.transfer.api.service.KxsCheckpointService;
|
|
|
|
|
+//
|
|
|
|
|
+///**
|
|
|
|
|
+// * store the checkpoint data in the shared storage, such us database, shared file storage...
|
|
|
|
|
+// * this meta store need to be completed by consumer
|
|
|
|
|
+// */
|
|
|
|
|
+//public class UserMetaStore extends AbstractUserMetaStore {
|
|
|
|
|
+//
|
|
|
|
|
+// private KxsCheckpointService kxsCheckpointService;
|
|
|
|
|
+//
|
|
|
|
|
+// public UserMetaStore(KxsCheckpointService kxsCheckpointService) {
|
|
|
|
|
+//
|
|
|
|
|
+// this.kxsCheckpointService = kxsCheckpointService;
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// @Override
|
|
|
|
|
+// protected void saveData(String groupID, String toStoreJson) {
|
|
|
|
|
+//
|
|
|
|
|
+// System.out.println("消费节点" + groupID+ "保存checkpoint数据:" + toStoreJson);
|
|
|
|
|
+// KxsCheckpoint kxsCheckpoint = new KxsCheckpoint();
|
|
|
|
|
+// kxsCheckpoint.setGroupId(groupID);
|
|
|
|
|
+// kxsCheckpoint.setCheckpoint(toStoreJson);
|
|
|
|
|
+// kxsCheckpointService.save(kxsCheckpoint);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// @Override
|
|
|
|
|
+// protected String getData(String groupID) {
|
|
|
|
|
+//
|
|
|
|
|
+// System.out.println("获取节点" + groupID);
|
|
|
|
|
+// KxsCheckpoint checkpoint = kxsCheckpointService.getOne(Wrappers.lambdaQuery(KxsCheckpoint.class)
|
|
|
|
|
+// .eq(KxsCheckpoint::getGroupId, groupID));
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// return checkpoint.getCheckpoint();
|
|
|
|
|
+// }
|
|
|
|
|
+//}
|