示例#1
0
        public override IExporter Export(IInvoker invoker)
        {
            var url      = invoker.GetUrl();
            var key      = ServiceKey(url);
            var exporter = new DubboExporter(invoker, key, Exporters);

            Exporters.TryAdd(key, exporter);
            var isStubSupportEvent = url.GetParameter(Constants.StubEventKey, Constants.DefaultStubEvent);
            var isCallbackService  = url.GetParameter(Constants.IsCallbackService, false);

            if (isStubSupportEvent && !isCallbackService)
            {
                var stubServiceMethods = url.GetParameter(Constants.StubEventMethodsKey, "");
                if (string.IsNullOrEmpty(stubServiceMethods))
                {
                    if (Logger.WarnEnabled)
                    {
                        Logger.Warn(new Exception("consumer [" + url.GetParameter(Constants.InterfaceKey, "") +
                                                  "], has set stubproxy support event ,but no stub methods founded."));
                    }
                }
                else
                {
                    _stubServiceMethods.TryAdd(url.ServiceName, stubServiceMethods);
                }
            }
            OpenServer(url);
            OptimizeSerialization(url);
            return(exporter);
        }
示例#2
0
 protected AbstractExporter(IInvoker invoker)
 {
     if (invoker == null)
     {
         throw new Exception("service invoker == null");
     }
     if (invoker.GetInterface() == null)
     {
         throw new Exception("service type == null");
     }
     if (invoker.GetUrl() == null)
     {
         throw new Exception("service url == null");
     }
     _Invoker = invoker;
 }