Nacos源码
2020-07-15 10:37:27 0 举报
Nacos主流程源码
作者其他创作
大纲/内容
taskDispatcher.addTask(key)
异步
queue.offer(key);
服务provider依赖spring-cloud-starter-alibaba-nacos-discoveryspring-cloud-alibaba-nacos-discoveryspring.factories其中AutoConfig相关的配置
serverProxy.registerService()
DistroConsistencyServiceImplput()
心跳任务
register()
task
DistroControlleronSyncDatum()
NacosDiscoveryAutoConfiguration
ephemeralInstances = toUpdateInstances;注册流程结束
bind()
初始化方法DistroConsistencyServiceImplinit()
@EventListener
BeatTaskrun()
Http请求
NacosAutoServiceRegistration
NacosServiceRegistry
重试机制retrySync()
CopyOnWrite新建注册信息Map更新完成之后覆盖ephemeralInstances
Service.updateIPs()
beatReactor.addBeatInfo()
@Bean
namingService.registerInstance()
Provider
NamingProxy.syncData()
DistroConsistencyServiceImplonPut()
非持久化默认
notifier.run()
持久化???
InstanceController.register()
维护注册信息
/api/clientBeat
ApplicationContextAware
进入注册中心
初始化方法TaskDispatcherinit()
AbstractAutoServiceRegistration
handle()
默认分批同步实例private int taskDispatchPeriod = 2000
GlobalExecutor.submitDistroNotifyTask(notifier)
Consumer发现???
onPut()
InstanceController.beat()
notifier.addTask()
start()
TaskSchedulerrun()
serviceManager.registerInstance()
/distro/datum
reqAPI() /instance
NacosRegistration
集群同步
开始:Spring-Boot体系
queue.poll
listener.onChange()
HTTP请求
consistencyService.put()
Extend
0 条评论
下一页