Skip to content
Permalink
Browse files
feature: add protocol config
  • Loading branch information
DLive committed May 7, 2019
1 parent 97fc0a6 commit 9ee886b2498e157b4916555d65532efbe6320623
Showing 7 changed files with 27 additions and 37 deletions.
@@ -12,7 +12,7 @@ The following features are supported.
* Zookeeper registry center (√)
* Tcp Transport
* Serialize
* Hession serialize (√)
* Hessian serialize (√)
* Json serialize (√)
* Erlang project as a consumer (√)
* Erlang project as a provider (√)
@@ -2,6 +2,7 @@
{dubboerl,[
{zookeeper_list,[{"127.0.0.1",2181}]},
{application,<<"testdubboerl">>},
{protocol,hessian},
{consumer,[
{<<"com.ifcoder.demo.facade.User">>,[]}
]},
@@ -0,0 +1,17 @@
# Protocol Configurations

The library now only supports hessian and json serialization.

## Configuration example
Protocol config is under the dubboerl application with sys.config
```erlang
{dubboerl,[
%% other config ...
{protocol,hessian}
]}
```

| ConfigName | Type | DefaultValue | Remarks |
| --- | --- | --- | --- |
| protocol | atom() | hessian | hessian,json |

@@ -203,7 +203,7 @@ decode_response(Res,Data)->
?SERIALIZATION_FASTJSON ->
dubbo_serializa_fastjson:decode_response(Res,Data);
?SERIALIZATION_HESSIAN ->
dubbo_serializa_hession:decode_response(Res,Data)
dubbo_serializa_hessian:decode_response(Res,Data)
end.

%%decode_response(?SERIALIZATION_FASTJSON,dubbo_rpc_invocation,Res,Data)->
@@ -233,7 +233,7 @@ decode_request(Req,Data)->
?SERIALIZATION_FASTJSON ->
dubbo_serializa_fastjson:decode_request(Req,Data);
?SERIALIZATION_HESSIAN ->
dubbo_serializa_hession:decode_request(Req,Data)
dubbo_serializa_hessian:decode_request(Req,Data)
end.

%%decode_request(dubbo_rpc_invocation,Req,Data)->
@@ -6,7 +6,7 @@
%%% @end
%%% Created : 11. May 2018 4:12 PM
%%%-------------------------------------------------------------------
-module(dubbo_serializa_hession).
-module(dubbo_serializa_hessian).
-author("dlive").

-include("dubbo.hrl").
@@ -6,7 +6,7 @@
%%% @end
%%% Created : 18. 十月 2016 上午10:46
%%%-------------------------------------------------------------------
-module(hession_encode_tests).
-module(hessian_encode_tests).
-author("dlive").

-include("hessian.hrl").
@@ -66,14 +66,7 @@ getUserInfo(Arg0, RequestOption)->
{<<"interface">> , ?CURRENT_CLASS_NAME}
]
},
Request = #dubbo_request{
is_event = false,
is_twoway = true,
mid = dubbo_id_generator:gen_id(),
data = Data,
mversion= <<"0.0.0">>,
serialize_type = ?SERIALIZATION_HESSIAN
},
Request = dubbo_adapter:reference(Data),
dubbo_invoker:invoke_request(?CURRENT_CLASS_NAME,Request,RequestOption).


@@ -102,14 +95,7 @@ genUserId( RequestOption)->
{<<"interface">> , ?CURRENT_CLASS_NAME}
]
},
Request = #dubbo_request{
is_event = false,
is_twoway = true,
mid = dubbo_id_generator:gen_id(),
data = Data,
mversion= <<"0.0.0">>,
serialize_type = ?SERIALIZATION_HESSIAN
},
Request = dubbo_adapter:reference(Data),
dubbo_invoker:invoke_request(?CURRENT_CLASS_NAME,Request,RequestOption).


@@ -140,14 +126,7 @@ queryUserInfo(Arg0, RequestOption)->
{<<"interface">> , ?CURRENT_CLASS_NAME}
]
},
Request = #dubbo_request{
is_event = false,
is_twoway = true,
mid = dubbo_id_generator:gen_id(),
data = Data,
mversion= <<"0.0.0">>,
serialize_type = ?SERIALIZATION_HESSIAN
},
Request = dubbo_adapter:reference(Data),
dubbo_invoker:invoke_request(?CURRENT_CLASS_NAME,Request,RequestOption).


@@ -178,13 +157,6 @@ queryUserList(Arg0, RequestOption)->
{<<"interface">> , ?CURRENT_CLASS_NAME}
]
},
Request = #dubbo_request{
is_event = false,
is_twoway = true,
mid = dubbo_id_generator:gen_id(),
data = Data,
mversion= <<"0.0.0">>,
serialize_type = ?SERIALIZATION_HESSIAN
},
Request = dubbo_adapter:reference(Data),
dubbo_invoker:invoke_request(?CURRENT_CLASS_NAME,Request,RequestOption).

0 comments on commit 9ee886b

Please sign in to comment.