redesign the subscription process
diff --git a/src/dubbo_directory.erl b/src/dubbo_directory.erl
index 2356e7c..08e959c 100644
--- a/src/dubbo_directory.erl
+++ b/src/dubbo_directory.erl
@@ -18,7 +18,7 @@
-behaviour(gen_server).
--export([subscribe/2,notify/1]).
+-export([subscribe/2,notify/2]).
%% API
-export([start_link/0]).
@@ -80,10 +80,31 @@
{error,Reason}
end.
-notify(UrlList)->
- dubbo_consumer_pool:start_consumer(Interface, UrlList),
+notify(Interface,UrlList)->
+ %% @todo if UrlList size is 1, and protocol is empty ,need destroyAllInvokers
+
+ case dubbo_extension:run_fold(protocol,refer,[UrlList],{error,no_protocol}) of
+ {ok,Invokers} ->
+ ok;
+ {error,no_protocol}->
+ error
+ end,
+%% dubbo_consumer_pool:start_consumer(Interface, UrlList),
ok.
+refresh_invoker(UrlList)->
+ NewInvokers = refresh_invoker(UrlList,[]).
+
+refresh_invoker([Url|Rest],Acc)->
+ case dubbo_extension:run_fold(protocol,refer,[Url],undefined) of
+ undefined ->
+ refresh_invoker(Rest,Acc);
+ {ok,Invoker} ->
+ refresh_invoker(Rest,[Invoker|Acc]);
+ {stop,_}->
+ refresh_invoker(Rest,Acc)
+ end.
+
%%--------------------------------------------------------------------
%% @private
%% @doc
diff --git a/src/dubbo_protocol.erl b/src/dubbo_protocol.erl
index 3c82119..8808fc8 100644
--- a/src/dubbo_protocol.erl
+++ b/src/dubbo_protocol.erl
@@ -16,7 +16,7 @@
%%------------------------------------------------------------------------------
-module(dubbo_protocol).
--callback refer(InterfaceClassInfo,Url)->ok.
+-callback refer(Url)->ok.
%% API
-export([refer/2]).
diff --git a/src/dubbo_protocol_dubbo.erl b/src/dubbo_protocol_dubbo.erl
index 2242939..c2fb6dd 100644
--- a/src/dubbo_protocol_dubbo.erl
+++ b/src/dubbo_protocol_dubbo.erl
@@ -18,4 +18,8 @@
-author("dlive").
%% API
--export([]).
+-export([refer/1]).
+
+refer(Url)->
+
+ {ok,todo}.
\ No newline at end of file
diff --git a/src/dubbo_protocol_registry.erl b/src/dubbo_protocol_registry.erl
index f1d9bc4..8277c7e 100644
--- a/src/dubbo_protocol_registry.erl
+++ b/src/dubbo_protocol_registry.erl
@@ -20,9 +20,9 @@
-include("dubboerl.hrl").
%% API
--export([]).
+-export([refer/1]).
-refer(InterfaceClassInfo,Url)->
+refer(Url)->
{ok,UrlInfo} = dubbo_common_fun:parse_url(Url),
{ok,RegistryName} = dubbo_registry:setup_register(UrlInfo),
diff --git a/src/dubbo_reference_config.erl b/src/dubbo_reference_config.erl
index f6e8bdd..6c58a50 100644
--- a/src/dubbo_reference_config.erl
+++ b/src/dubbo_reference_config.erl
@@ -35,7 +35,7 @@
InterfaceClassInfo = #{},
Para = gen_parameter(),
Url = gen_registry_url(Para),
- dubbo_extension:run(protoco_wapper,refer,[InterfaceClassInfo,Url]),
+ dubbo_extension:run(protocol_wapper,refer,[Url]),
ok.
%%application=hello-world&dubbo=2.0.2&pid=68901&refer=application=hello-world&default.check=false&default.lazy=false&default.retries=0&default.sticky=false&default.timeout=300000&dubbo=2.0.2&interface=org.apache.dubbo.erlang.sample.service.facade.UserOperator&lazy=false&methods=queryUserInfo,queryUserList,genUserId,getUserInfo&pid=68901®ister.ip=127.0.0.1&release=2.7.1&retries=0&side=consumer&sticky=false×tamp=1559727789953®istry=zookeeper&release=2.7.1×tamp=1559727842451
diff --git a/src/dubbo_registry_zookeeper.erl b/src/dubbo_registry_zookeeper.erl
index ea9ef62..0b5b3f5 100644
--- a/src/dubbo_registry_zookeeper.erl
+++ b/src/dubbo_registry_zookeeper.erl
@@ -240,7 +240,7 @@
get_provider_list(InterfaceName,ZkPid,NotifyFun) ->
InterfacePath = <<<<"/dubbo/">>/binary, InterfaceName/binary, <<"/providers">>/binary>>,
ChildList= get_provider_and_start(ZkPid, InterfaceName, InterfacePath),
- NotifyFun(ChildList),
+ NotifyFun(InterfaceName,ChildList),
ok.
get_provider_and_start(Pid, Interface, Path) ->
case erlzk:get_children(Pid, Path, spawn(dubbo_registry_zookeeper, provider_watcher, [Interface])) of