We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
目前启动上层框架(application-http、application-rpc)是通过底层(artusApplication)emit 一个事件来完成的。
这就意味着上层框架需要在lifecycle中注册对于的hook,来完成进程的启动,流程如下:
hook的定义(wiki)是:通过劫持来完成主逻辑的“增强或者调整”。
而当前的设计流程,其实是把hook的逻辑,作为了启动主流程的关键一步,没有这个hook,主流程走不下去。
后续带来的问题如下:
经过和梓恒、胜凯的讨论,一个可能的解决方案是:
这样,用户可以用@AppBootStrap来定义一个class,专门负责启动逻辑。
伪代码如下:
// XApplication.ts class XApplication{ start(){ // step1: artusApp.load(manifest) // step2: const busiBootStraps = container.get({set: 'AppBootStrap'}); busiBootStraps.forEach(one => one.run())// 这里上层框架完成路由、中间件、listen } } // 上层框架 @AppBootStrap class HttpBootStrap{ run(){ // 注册路由、listen } } @AppBootStrap class RpcBootStrap{ run(){ // 注册路由、listen } }
The text was updated successfully, but these errors were encountered:
感觉上这个调整也还可以,虽然只是语义上更清晰了,本质上和 hook 的机理差不多?
Sorry, something went wrong.
No branches or pull requests
一.背景
目前启动上层框架(application-http、application-rpc)是通过底层(artusApplication)emit 一个事件来完成的。
这就意味着上层框架需要在lifecycle中注册对于的hook,来完成进程的启动,流程如下:
二.问题
hook的定义(wiki)是:通过劫持来完成主逻辑的“增强或者调整”。
而当前的设计流程,其实是把hook的逻辑,作为了启动主流程的关键一步,没有这个hook,主流程走不下去。
后续带来的问题如下:
三.调整
经过和梓恒、胜凯的讨论,一个可能的解决方案是:
这样,用户可以用@AppBootStrap来定义一个class,专门负责启动逻辑。
伪代码如下:
The text was updated successfully, but these errors were encountered: