接口 ConsistencyService

    • 方法概要

      所有方法 实例方法 抽象方法 
      修饰符和类型 方法 说明
      Datum get​(java.lang.String key)
      Get a data from Nacos cluster.
      java.util.Optional<java.lang.String> getErrorMsg()
      Get the error message of the consistency protocol.
      boolean isAvailable()
      Tell the status of this consistency service.
      void listen​(java.lang.String key, RecordListener listener)
      Listen for changes of a data.
      void put​(java.lang.String key, Record value)
      Put a data related to a key to Nacos cluster.
      void remove​(java.lang.String key)
      Remove a data from Nacos cluster.
      void unListen​(java.lang.String key, RecordListener listener)
      Cancel listening of a data.
    • 方法详细资料

      • put

        void put​(java.lang.String key,
                 Record value)
          throws com.alibaba.nacos.api.exception.NacosException
        Put a data related to a key to Nacos cluster.
        参数:
        key - key of data, this key should be globally unique
        value - value of data
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception
      • remove

        void remove​(java.lang.String key)
             throws com.alibaba.nacos.api.exception.NacosException
        Remove a data from Nacos cluster.
        参数:
        key - key of data
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception
      • get

        Datum get​(java.lang.String key)
           throws com.alibaba.nacos.api.exception.NacosException
        Get a data from Nacos cluster.
        参数:
        key - key of data
        返回:
        data related to the key
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception
      • listen

        void listen​(java.lang.String key,
                    RecordListener listener)
             throws com.alibaba.nacos.api.exception.NacosException
        Listen for changes of a data.
        参数:
        key - key of data
        listener - callback of data change
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception
      • unListen

        void unListen​(java.lang.String key,
                      RecordListener listener)
               throws com.alibaba.nacos.api.exception.NacosException
        Cancel listening of a data.
        参数:
        key - key of data
        listener - callback of data change
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception
      • getErrorMsg

        java.util.Optional<java.lang.String> getErrorMsg()
        Get the error message of the consistency protocol.
        返回:
        the consistency protocol error message.
      • isAvailable

        boolean isAvailable()
        Tell the status of this consistency service.
        返回:
        true if available