《重新定义Spring Cloud实战》——3.2 服务的核心操作
3.2 服务的核心操作
3.2.1 概述
对于服务发现来说,围绕服务实例主要有如下几个重要的操作:
服务注册(register)
服务下线(cancel)
服务租约(renew)
服务剔除(evict)
围绕这几个功能,Eureka设计了几个核心操作类:
com/netflix/eureka/lease/LeaseManager.java
com/netflix/discovery/shared/LookupService.java
com/netflix/eureka/registry/InstanceRegistry.java
com/netflix/eureka/registry/AbstractInstanceRegistry.java
com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java
Spring Cloud Eureka在Netflix Eureka的基础上,抽象或定义了如下几个核心类:
org/springframework/cloud/netflix/eureka/server/InstanceRegistry.java
org/springframework/cloud/client/serviceregistry/ServiceRegistry.java
org/springframework/cloud/netflix/eureka/serviceregistry/EurekaServiceRegistry.java
org/springframework/cloud/netflix/eureka/serviceregistry/EurekaRegistration.java
org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java
org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java
org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBean.java
其中LeaseManager以及LookupService是Eureka关于服务发现相关操作定义的接口类,前者定义了服务写操作相关的方法,后者定义了查询操作相关的方法。下面我们重点看下这两个类。
- 点赞
- 收藏
- 关注作者
评论(0)