define extension fun return value
diff --git a/src/dubbo_extension.erl b/src/dubbo_extension.erl
index ee4dae2..75db250 100644
--- a/src/dubbo_extension.erl
+++ b/src/dubbo_extension.erl
@@ -89,8 +89,8 @@
             Acc;
         {stop, NewAcc} ->
             NewAcc;
-        _ ->
-            run_fold1(Rest, HookName, Fun, Args0, Ret)
+        {ok,NewAcc2} ->
+            run_fold1(Rest, HookName, Fun, Args0, NewAcc2)
     end.
 
 invoke_foldr(HookName, Fun, Args, Acc) ->
@@ -116,8 +116,6 @@
         {'EXIT', Reason} ->
             logger:error("~p~n error running hook: ~p~n", [HookName, Reason]),
             do_invoke(Rest, HookName, Fun, Args0, Acc);
-        stop ->
-            Acc;
         {stop, NewAcc} ->
             NewAcc;
         {ok, Args2, NewAcc2} ->
diff --git a/src/dubbo_filter.erl b/src/dubbo_filter.erl
index c0c1a4f..ef25a2e 100644
--- a/src/dubbo_filter.erl
+++ b/src/dubbo_filter.erl
@@ -17,12 +17,11 @@
 -module(dubbo_filter).
 -include("dubbo.hrl").
 
--type filter_result() :: {stop, term()}|{error, term()}|term().
+-type filter_result() :: {ok, Invocation :: invocation(), Acc :: invoke_result()}|{stop, term()}.
 
 -callback(invoke(Invocation :: #dubbo_rpc_invocation{}, Acc :: invoke_result()) -> filter_result()).
 
 -callback(on_response(Invocation :: invocation(), Result :: invoke_result()) -> filter_result()).
-%% API
--export([]).
+
 
 
diff --git a/src/dubbo_protocol.erl b/src/dubbo_protocol.erl
index 9a5e659..4af3ea5 100644
--- a/src/dubbo_protocol.erl
+++ b/src/dubbo_protocol.erl
@@ -18,6 +18,6 @@
 
 -include("dubbo.hrl").
 
--callback refer(Url :: binary(), Acc :: term()) -> ok.
+-callback refer(Url :: binary(), Acc :: term()) -> {ok,Acc}.
 
--callback export(Invoker :: #invoker{}, Acc :: term()) -> ok.
+-callback export(Invoker :: #invoker{}, Acc :: term()) -> {ok,Acc}.
diff --git a/src/dubbo_protocol_dubbo.erl b/src/dubbo_protocol_dubbo.erl
index fc6a224..ae76035 100644
--- a/src/dubbo_protocol_dubbo.erl
+++ b/src/dubbo_protocol_dubbo.erl
@@ -15,6 +15,7 @@
 %% limitations under the License.
 %%------------------------------------------------------------------------------
 -module(dubbo_protocol_dubbo).
+-behaviour(dubbo_protocol).
 
 -include("dubboerl.hrl").
 -include("dubbo.hrl").
@@ -30,7 +31,7 @@
             {ok, Invoker} = do_refer(UrlInfo),
             {ok, Invoker};
         _ ->
-            {skip, Acc}
+            {ok, Acc}
     end.
 
 do_refer(UrlInfo) ->
diff --git a/src/dubbo_protocol_registry.erl b/src/dubbo_protocol_registry.erl
index 47174f6..dd1c0f8 100644
--- a/src/dubbo_protocol_registry.erl
+++ b/src/dubbo_protocol_registry.erl
@@ -34,8 +34,7 @@
     dubbo_registry:register(RegistryName, ConsumerUrl),
 
     dubbo_directory:subscribe(RegistryName, ConsumerUrl),
-
-    ok.
+    {ok,Acc}.
 
 export(Invoker, Acc) ->
     {ok, UrlInfo} = dubbo_common_fun:parse_url(Invoker#invoker.url),
@@ -48,15 +47,13 @@
     dubbo_registry:register(RegistryName, ProtocolUrl),
 
     register_export_info(ProtocolUrl, RegistryName, InterfaceKey),
-    {ok, Invoker}.
+    {ok, Acc}.
 
 destroy() ->
     List = ets:tab2list(?SERVICE_EXPORT_TABLE),
     lists:map(
         fun(Item) ->
-
             {ProtocolUrl, RegistryModule, _} = Item,
-            io:format(user, "destroy url ~p~n", [ProtocolUrl]),
             unexport(RegistryModule, ProtocolUrl)
         end, List),
     ok.
diff --git a/src/dubbo_registry.erl b/src/dubbo_registry.erl
index 01af02c..754b2f4 100644
--- a/src/dubbo_registry.erl
+++ b/src/dubbo_registry.erl
@@ -17,9 +17,9 @@
 -module(dubbo_registry).
 -include("dubboerl.hrl").
 
--callback start(Url :: binary) -> ok.
--callback register(Url :: binary()) -> term().
--callback subscribe(SubcribeUrl :: binary(), NotifyFun :: function()) -> ok.
+-callback start(Url :: binary) -> ok | {error,Reason::term()}.
+-callback register(Url :: binary()) -> ok | {error,Reason::term()}.
+-callback subscribe(SubcribeUrl :: binary(), NotifyFun :: function()) -> ok | {error,Reason::term()}.
 
 %% API
 -export([setup_register/1, register/2, unregister/2, get_registry_host_port/0, get_registry_type/0, get_registry_module/1]).
diff --git a/src/dubbo_service_config.erl b/src/dubbo_service_config.erl
index 2f595ba..d59f38d 100644
--- a/src/dubbo_service_config.erl
+++ b/src/dubbo_service_config.erl
@@ -39,8 +39,6 @@
     ok.
 
 
-
-
 get_registry_url(ProviderInfo) ->
     {Host, Port} = dubbo_registry:get_registry_host_port(),
     UrlInfo = #dubbo_url{