接口 InstanceOperator

    • 方法概要

      所有方法 实例方法 抽象方法 
      修饰符和类型 方法 说明
      java.util.List<java.lang.String> batchDeleteMetadata​(java.lang.String namespaceId, InstanceOperationInfo instanceOperationInfo, java.util.Map<java.lang.String,​java.lang.String> metadata)
      Batch delete metadata of instances.
      java.util.List<java.lang.String> batchUpdateMetadata​(java.lang.String namespaceId, InstanceOperationInfo instanceOperationInfo, java.util.Map<java.lang.String,​java.lang.String> metadata)
      Batch update metadata of instances.
      long getHeartBeatInterval​(java.lang.String namespaceId, java.lang.String serviceName, java.lang.String ip, int port, java.lang.String cluster)
      Get heart beat interval for specified instance.
      com.alibaba.nacos.api.naming.pojo.Instance getInstance​(java.lang.String namespaceId, java.lang.String serviceName, java.lang.String cluster, java.lang.String ip, int port)
      Get instance detail information.
      int handleBeat​(java.lang.String namespaceId, java.lang.String serviceName, java.lang.String ip, int port, java.lang.String cluster, RsInfo clientBeat, BeatInfoInstanceBuilder builder)
      Handle beat request.
      java.util.List<? extends com.alibaba.nacos.api.naming.pojo.Instance> listAllInstances​(java.lang.String namespaceId, java.lang.String serviceName)
      List all instances whatever status they are.
      com.alibaba.nacos.api.naming.pojo.ServiceInfo listInstance​(java.lang.String namespaceId, java.lang.String serviceName, Subscriber subscriber, java.lang.String cluster, boolean healthOnly)
      Get all instance of input service.
      void patchInstance​(java.lang.String namespaceId, java.lang.String serviceName, InstancePatchObject patchObject)
      Patch update instance information.
      void registerInstance​(java.lang.String namespaceId, java.lang.String serviceName, com.alibaba.nacos.api.naming.pojo.Instance instance)
      Register an instance to a service in AP mode.
      void removeInstance​(java.lang.String namespaceId, java.lang.String serviceName, com.alibaba.nacos.api.naming.pojo.Instance instance)
      Remove instance from service.
      void updateInstance​(java.lang.String namespaceId, java.lang.String serviceName, com.alibaba.nacos.api.naming.pojo.Instance instance)
      Update instance information.
    • 方法详细资料

      • registerInstance

        void registerInstance​(java.lang.String namespaceId,
                              java.lang.String serviceName,
                              com.alibaba.nacos.api.naming.pojo.Instance instance)
                       throws com.alibaba.nacos.api.exception.NacosException
        Register an instance to a service in AP mode.
        参数:
        namespaceId - id of namespace
        serviceName - grouped service name group@@service
        instance - instance to register
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception when register failed
      • removeInstance

        void removeInstance​(java.lang.String namespaceId,
                            java.lang.String serviceName,
                            com.alibaba.nacos.api.naming.pojo.Instance instance)
                     throws com.alibaba.nacos.api.exception.NacosException
        Remove instance from service.
        参数:
        namespaceId - namespace
        serviceName - grouped service name group@@service
        instance - instance
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception when remove failed
      • updateInstance

        void updateInstance​(java.lang.String namespaceId,
                            java.lang.String serviceName,
                            com.alibaba.nacos.api.naming.pojo.Instance instance)
                     throws com.alibaba.nacos.api.exception.NacosException
        Update instance information. Due to the basic information can't be changed, so this update should only update metadata.

        Update API will replace the whole metadata with new input instance.

        参数:
        namespaceId - namespace
        serviceName - grouped service name group@@service
        instance - instance
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception when update failed
      • patchInstance

        void patchInstance​(java.lang.String namespaceId,
                           java.lang.String serviceName,
                           InstancePatchObject patchObject)
                    throws com.alibaba.nacos.api.exception.NacosException
        Patch update instance information. Due to the basic information can't be changed, so this update should only update metadata.

        Patch update will only update variables in requests, the others will keep original value.

        参数:
        namespaceId - namespace
        serviceName - grouped service name group@@service
        patchObject - objects need to be patch
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception when update failed
      • listInstance

        com.alibaba.nacos.api.naming.pojo.ServiceInfo listInstance​(java.lang.String namespaceId,
                                                                   java.lang.String serviceName,
                                                                   Subscriber subscriber,
                                                                   java.lang.String cluster,
                                                                   boolean healthOnly)
                                                            throws java.lang.Exception
        Get all instance of input service.
        参数:
        namespaceId - namespace
        serviceName - grouped service name group@@service
        subscriber - subscriber info
        cluster - cluster of instances
        healthOnly - whether only return health instances
        返回:
        service info
        抛出:
        java.lang.Exception - exception when list instance failed
      • getInstance

        com.alibaba.nacos.api.naming.pojo.Instance getInstance​(java.lang.String namespaceId,
                                                               java.lang.String serviceName,
                                                               java.lang.String cluster,
                                                               java.lang.String ip,
                                                               int port)
                                                        throws com.alibaba.nacos.api.exception.NacosException
        Get instance detail information.
        参数:
        namespaceId - namespace
        serviceName - grouped service name group@@service
        cluster - cluster of instance
        ip - ip of instance
        port - port of instance
        返回:
        instance info
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception during query
      • handleBeat

        int handleBeat​(java.lang.String namespaceId,
                       java.lang.String serviceName,
                       java.lang.String ip,
                       int port,
                       java.lang.String cluster,
                       RsInfo clientBeat,
                       BeatInfoInstanceBuilder builder)
                throws com.alibaba.nacos.api.exception.NacosException
        Handle beat request.
        参数:
        namespaceId - namespace
        serviceName - grouped service name group@@service
        ip - ip of instance
        port - port of instance
        cluster - cluster of instance
        clientBeat - client beat info
        builder - client beat instance builder, will be used when current instance is not exist and clientBeat exist
        返回:
        result code
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception when service non-exist and client beat info is null
      • getHeartBeatInterval

        long getHeartBeatInterval​(java.lang.String namespaceId,
                                  java.lang.String serviceName,
                                  java.lang.String ip,
                                  int port,
                                  java.lang.String cluster)
        Get heart beat interval for specified instance.
        参数:
        namespaceId - namespace
        serviceName - grouped service name group@@service
        ip - ip of instance
        port - port of instance
        cluster - cluster of instance
        返回:
        heart beat interval
      • listAllInstances

        java.util.List<? extends com.alibaba.nacos.api.naming.pojo.Instance> listAllInstances​(java.lang.String namespaceId,
                                                                                              java.lang.String serviceName)
                                                                                       throws com.alibaba.nacos.api.exception.NacosException
        List all instances whatever status they are.
        参数:
        namespaceId - namespace
        serviceName - grouped service name group@@service
        返回:
        all instances
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception during query
      • batchUpdateMetadata

        java.util.List<java.lang.String> batchUpdateMetadata​(java.lang.String namespaceId,
                                                             InstanceOperationInfo instanceOperationInfo,
                                                             java.util.Map<java.lang.String,​java.lang.String> metadata)
                                                      throws com.alibaba.nacos.api.exception.NacosException
        Batch update metadata of instances.
        参数:
        namespaceId - namespace Id of instances
        instanceOperationInfo - instance operation info
        metadata - updated metadata
        返回:
        updated instance
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception during update
      • batchDeleteMetadata

        java.util.List<java.lang.String> batchDeleteMetadata​(java.lang.String namespaceId,
                                                             InstanceOperationInfo instanceOperationInfo,
                                                             java.util.Map<java.lang.String,​java.lang.String> metadata)
                                                      throws com.alibaba.nacos.api.exception.NacosException
        Batch delete metadata of instances.
        参数:
        namespaceId - namespace Id of instances
        instanceOperationInfo - instance operation info
        metadata - delete metadata
        返回:
        updated instance
        抛出:
        com.alibaba.nacos.api.exception.NacosException - nacos exception during update