Java Code Examples for com.alibaba.otter.canal.common.zookeeper.ZookeeperPathUtils#getCursorPath()
The following examples show how to use
com.alibaba.otter.canal.common.zookeeper.ZookeeperPathUtils#getCursorPath() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZooKeeperMetaManager.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
public Position getCursor(ClientIdentity clientIdentity) throws CanalMetaManagerException { String path = ZookeeperPathUtils.getCursorPath(clientIdentity.getDestination(), clientIdentity.getClientId()); byte[] data = zkClientx.readData(path, true); if (data == null || data.length == 0) { return null; } return JsonUtils.unmarshalFromByte(data, Position.class); }
Example 2
Source File: ZooKeeperMetaManager.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
public void updateCursor(ClientIdentity clientIdentity, Position position) throws CanalMetaManagerException { String path = ZookeeperPathUtils.getCursorPath(clientIdentity.getDestination(), clientIdentity.getClientId()); byte[] data = JsonUtils.marshalToByte(position, SerializerFeature.WriteClassName); try { zkClientx.writeData(path, data); } catch (ZkNoNodeException e) { zkClientx.createPersistent(path, data, true);// 第一次节点不存在,则尝试重建 } }
Example 3
Source File: ZooKeeperMetaManager.java From canal with Apache License 2.0 | 5 votes |
public Position getCursor(ClientIdentity clientIdentity) throws CanalMetaManagerException { String path = ZookeeperPathUtils.getCursorPath(clientIdentity.getDestination(), clientIdentity.getClientId()); byte[] data = zkClientx.readData(path, true); if (data == null || data.length == 0) { return null; } return JsonUtils.unmarshalFromByte(data, Position.class); }
Example 4
Source File: ZooKeeperMetaManager.java From canal with Apache License 2.0 | 5 votes |
public void updateCursor(ClientIdentity clientIdentity, Position position) throws CanalMetaManagerException { String path = ZookeeperPathUtils.getCursorPath(clientIdentity.getDestination(), clientIdentity.getClientId()); byte[] data = JsonUtils.marshalToByte(position, SerializerFeature.WriteClassName); try { zkClientx.writeData(path, data); } catch (ZkNoNodeException e) { zkClientx.createPersistent(path, data, true);// 第一次节点不存在,则尝试重建 } }