tesla笔记2

tesla framework

tesla使用注册listener,然后publish event这种模式去完成初始化。

1、注册listener

1、FurionSubscribeModule
context.registerEventListener(
  SubscribeEvent.class, this.subscribeEventListener);

2、CheckHealthHandler
context.registerEventListener(FrameworkStarted.class,        
new EventListener() {            
});

3、CheckHealthHandler
context.registerEventListener(FrameworkStopped.class, 
new EventListener() { }
);

4、DynamicDictionary
this.context.registerEventListener(RoutersChangedEvent.class)

5、DynamicDictionary
this.context.registerEventListener(ProvidersChangedEvent.class)

6、DynamicDictionary
this.context.registerEventListener(SingleProviderEvent.class)

7、InvokerInvocationHandler
context.registerEventListener(MethodsChangedEvent.class, this);

8、ReferServiceFactory
frameworkContext.registerEventListener(ReferResult.class)

9、TeslaExposeModule
context.registerEventListener(ExposeConfig.class)

10、TeslaExposeModule
context.registerEventListener(ReferResult.class)

11、TeslaReferModule
context.registerEventListener(ReferConfig.class)

2、publish event

1、DynamicDictionary
this.context.publishEvent(new SubscribeEvent(SubscribeEvent.Type.ROUTERS, routerKey));

2、DynamicDictionary
this.context.publishEvent(new SubscribeEvent(SubscribeEvent.Type.PROVIDERS, subscribeKey));

3、DynamicDictionary
this.context.publishEvent(        
  new SubscribeEvent( 
    SubscribeEvent.Type.SINGLE_PROVIDER,
    Constants.REGISTRY_SERVICE_NAME+Constants.META_DATA_SUFFIX));

4、FrameworkLauncher
frameworkContext.publishEvent(new FrameworkStarted());

5、FrameworkLauncher
toClose.publishEvent(new FrameworkStopped());

6、FurionSubscribeModule
  case PROVIDERS:    
  context.publishEvent(new ProvidersChangedEvent(value));   
  break;
  case ROUTERS:   
  context.publishEvent(new RoutersChangedEvent(value));    
  break;
  case METHODS:    
  notifyMethodsChanged(value, event.getSubscribeKey());    
  break;
  case SINGLE_PROVIDER:    
  context.publishEvent(new SingleProviderEvent(value));    
  break;

7、FurionSubscribeModule
this.context.publishEvent(new MethodsChangedEvent(serviceDefaultTimeout, methodTimeouts));

8、InvokerInvocationHandler
context.publishEvent(        
new SubscribeEvent(SubscribeEvent.Type.METHODS, appName + "_" + service));

9、ReferServiceFactory
frameworkContext.publishEvent(referConfig);

10、TeslaExposeModule
context.publishEvent(referConfig);

11、TeslaReferModule
context.publishEvent(ReferResult);

12、TeslaServiceScanner
frameworkContext.publishEvent(ExposeConfig);

你可能感兴趣的:(tesla笔记2)