ing
This commit is contained in:
parent
ebee7e2d27
commit
e107b6b207
|
@ -15,21 +15,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func New(portNumber int) *crc.Client {
|
func New(portNumber int) *crc.Client {
|
||||||
rpcWriteChan := make(chan []byte, 256)
|
|
||||||
rpcClientCodec := crpj.NewClientCodec()
|
rpcClientCodec := crpj.NewClientCodec()
|
||||||
|
|
||||||
cdr.RegisterResource(container.CONTAINER_CRAWLERS, crawler.GetCrawlers())
|
|
||||||
cdr.RegisterResource(container.CONTAINER_RPC_WRITE_CHAN, rpcWriteChan)
|
|
||||||
cdr.RegisterResource(container.CONTAINER_RPC_CLIENT_CODEC, rpcClientCodec)
|
|
||||||
|
|
||||||
services, err := cdr.GetInstancesByAnnotationType(occa.RPCServiceAnnotationType)
|
|
||||||
if nil != err {
|
|
||||||
logging.Logger().Panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
rpcRegistry := crr.NewRPCRegistry()
|
|
||||||
rpcRegistry.RegisterServices(services...)
|
|
||||||
|
|
||||||
connector, err := occ.NewConnector(occp.ContainerDiscovery, portNumber)
|
connector, err := occ.NewConnector(occp.ContainerDiscovery, portNumber)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logging.Logger().Panic(err)
|
logging.Logger().Panic(err)
|
||||||
|
@ -39,11 +26,25 @@ func New(portNumber int) *crc.Client {
|
||||||
ch.Name = occp.ContainerDiscovery.String()
|
ch.Name = occp.ContainerDiscovery.String()
|
||||||
ch.Connector = connector
|
ch.Connector = connector
|
||||||
ch.RPCCodec = rpcClientCodec
|
ch.RPCCodec = rpcClientCodec
|
||||||
|
|
||||||
|
c := &crc.Client{
|
||||||
|
ClientHandler: ch,
|
||||||
|
}
|
||||||
|
|
||||||
|
cdr.RegisterResource(container.CONTAINER_CRAWLERS, crawler.GetCrawlers())
|
||||||
|
cdr.RegisterResource(container.CONTAINER_RPC_CLIENT, c)
|
||||||
|
|
||||||
|
services, err := cdr.GetInstancesByAnnotationType(occa.RPCServiceAnnotationType)
|
||||||
|
if nil != err {
|
||||||
|
logging.Logger().Panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
rpcRegistry := crr.NewRPCRegistry()
|
||||||
|
rpcRegistry.RegisterServices(services...)
|
||||||
|
|
||||||
ch.RPCInvoker = rpcRegistry
|
ch.RPCInvoker = rpcRegistry
|
||||||
ch.Services = services
|
ch.Services = services
|
||||||
ch.OrderedServices = service.OrderedServices
|
ch.OrderedServices = service.OrderedServices
|
||||||
|
|
||||||
return &crc.Client{
|
return c
|
||||||
ClientHandler: ch,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user