-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (32 loc) · 1.03 KB
/
index.js
File metadata and controls
36 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var Config = require('./lib/config/index'),
Invoker = require('./lib/rpc/api/invoker/index'),
InvokerDesc = require('./lib/rpc/api/invoker/desc'),
InvokerProxy = require('./lib/rpc/api/invoker/proxy'),
Registry = require('./lib/registry/index');
//-----------------------------------------------------------------------------------------------
//
//
//
//
//-----------------------------------------------------------------------------------------------
module.exports = {
/**
* 配置加载
*/
config: function (path) {
Config.load(path);
Registry.init();
},
/**
* rpc调用, 主要调用入口
*/
getService: function (serviceName, version, group) {
var invokerDesc = new InvokerDesc(serviceName, group, version),
invoker = Registry.getInvoker(invokerDesc);
if (!invoker) {
invoker = new Invoker(invokerDesc);
Registry.register(invokerDesc, new InvokerProxy(invoker, invokerDesc));
}
return invoker;
}
};