Skip to content
Snippets Groups Projects
Commit 4fea11b1 authored by vito.he's avatar vito.he
Browse files

Add:resolve conflict

parents 33646c2b 0ef1b755
No related branches found
No related tags found
No related merge requests found
......@@ -83,7 +83,6 @@ func (s *Service) Rcvr() reflect.Value {
//////////////////////////
// serviceMap
// todo: use sync.Map?
//////////////////////////
type serviceMap struct {
......
......@@ -198,3 +198,29 @@ func loadProtocol(protocolsIds string, protocols []ProtocolConfig) []ProtocolCon
}
return returnProtocols
}
// Dubbo Init
func Load() (map[string]*ReferenceConfig, map[string]*ServiceConfig) {
refMap := make(map[string]*ReferenceConfig)
srvMap := make(map[string]*ServiceConfig)
// reference config
length := len(consumerConfig.References)
for index := 0; index < length; index++ {
con := &consumerConfig.References[index]
con.Implement(services[con.Interface])
con.Refer()
refMap[con.Interface] = con
}
// service config
length = len(providerConfig.Services)
for index := 0; index < length; index++ {
pro := &providerConfig.Services[index]
pro.Implement(services[pro.Interface])
pro.Export()
srvMap[pro.Interface] = pro
}
return refMap, srvMap
}
......@@ -60,7 +60,8 @@ func (refconfig *ReferenceConfig) Refer() {
//TODO:multi registries ,just wrap multi registry as registry cluster invoker including cluster invoker
}
//create proxy
attachments := map[string]string{} // todo : attachments is necessary, include keys: ASYNC_KEY、
attachments := map[string]string{}
attachments[constant.ASYNC_KEY] = url.GetParam(constant.ASYNC_KEY, "false")
refconfig.pxy = proxy.NewProxy(refconfig.invoker, nil, attachments)
}
......
package support
import "github.com/dubbo/dubbo-go/config"
var (
services = map[string]config.RPCService{} // service name -> service
)
// SetService is called by init() of implement of RPCService
func SetService(service config.RPCService) {
services[service.Service()] = service
}
func GetService(name string) config.RPCService {
return services[name]
}
......@@ -177,8 +177,9 @@ func (h *RpcServerHandler) OnMessage(session getty.Session, pkg interface{}) {
invoker := h.exporter.GetInvoker()
if invoker != nil {
attchments := map[string]string{}
// todo: use them followingly if need
url := invoker.GetUrl()
attchments[constant.PATH_KEY] = url.Path
attchments[constant.GROUP_KEY] = url.GetParam(constant.GROUP_KEY, "")
attchments[constant.SERVICE_KEY] = url.Service
......
......@@ -28,7 +28,6 @@ type RPCInvocation struct {
invoker Invoker
}
// todo: arguments table is too many
func NewRPCInvocationForConsumer(methodName string, parameterTypes []reflect.Type, arguments []interface{},
reply interface{}, callBack interface{}, attachments map[string]string, invoker Invoker) *RPCInvocation {
return &RPCInvocation{
......
......@@ -135,8 +135,9 @@ func (s *Server) handlePkg(conn net.Conn) {
invoker := s.exporter.GetInvoker()
if invoker != nil {
attchments := map[string]string{}
// todo: use them followingly if need
url := invoker.GetUrl()
attchments[constant.PATH_KEY] = url.Path
attchments[constant.GROUP_KEY] = url.GetParam(constant.GROUP_KEY, "")
attchments[constant.SERVICE_KEY] = url.Service
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment