Skip to content
Permalink
Browse files
feature: add mutil invoke method
  • Loading branch information
DLive committed May 5, 2019
1 parent f169548 commit ae9c68fcbe19738ea28b6233f69cdf14c217a8c4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
@@ -11,7 +11,7 @@

-include("dubbo.hrl").
%% API
-export([invoke_request/2,invoke_request/5]).
-export([invoke_request/2,invoke_request/3,invoke_request/5]).

-spec invoke_request(Interface::binary(),Request::#dubbo_request{})->
{ok,reference()}|
@@ -20,6 +20,14 @@
invoke_request(Interface,Request)->
invoke_request(Interface,Request,[],#{},self()).

-spec invoke_request(Interface::binary(),Request::#dubbo_request{},RequestOption::map())->
{ok,reference()}|
{ok,reference(),Data::any(),RpcContent::list()}|
{error,Reason::timeout|no_provider|any()}.
invoke_request(Interface,Request,RequestOption)->
invoke_request(Interface,Request,maps:get(ctx,RequestOption,[]),RequestOption,self()).


-spec invoke_request(Interface::binary(),Request::#dubbo_request{},RpcContext::list(),RequestState::map(),CallBackPid::pid())->
{ok,reference()}|
{ok,reference(),Data::any(),RpcContent::list()}|
@@ -8,6 +8,7 @@
get_list()->
[
{userInfoRequest,<<"com.ifcoder.demo.bean.UserInfoRequest">>,record_info(fields,userInfoRequest)},
{list,<<"java.util.List">>,record_info(fields,list)},
{userInfo,<<"com.ifcoder.demo.bean.UserInfo">>,record_info(fields,userInfo)},
{userRes,<<"com.ifcoder.demo.bean.UserRes">>,record_info(fields,userRes)} ].

@@ -44,9 +44,9 @@ get_method_999_list()->
{ok,reference(),Data::#userInfo{},RpcContent::list()}|
{error,Reason::timeout|no_provider|any()}.
getUserInfo(Arg0)->
getUserInfo(Arg0 ,[]).
getUserInfo(Arg0 ,#{}).

getUserInfo(Arg0, Option)->
getUserInfo(Arg0, RequestOption)->

Data = #dubbo_rpc_invocation{
className = ?CURRENT_CLASS_NAME,
@@ -69,22 +69,22 @@ getUserInfo(Arg0, Option)->
Request = #dubbo_request{
is_event = false,
is_twoway = true,
mid = de_id_count:gen_id(),
mid = dubbo_id_generator:gen_id(),
data = Data,
mversion= <<"0.0.0">>,
serialize_type = ?SERIALIZATION_HESSIAN
},
dubbo_invoker:invoke_request(?CURRENT_CLASS_NAME,Request).
dubbo_invoker:invoke_request(?CURRENT_CLASS_NAME,Request,RequestOption).


-spec genUserId()->
{ok,reference()}|
{ok,reference(),Data::list(),RpcContent::list()}|
{error,Reason::timeout|no_provider|any()}.
genUserId()->
genUserId( []).
genUserId( #{}).

genUserId( Option)->
genUserId( RequestOption)->

Data = #dubbo_rpc_invocation{
className = ?CURRENT_CLASS_NAME,
@@ -105,22 +105,22 @@ genUserId( Option)->
Request = #dubbo_request{
is_event = false,
is_twoway = true,
mid = de_id_count:gen_id(),
mid = dubbo_id_generator:gen_id(),
data = Data,
mversion= <<"0.0.0">>,
serialize_type = ?SERIALIZATION_HESSIAN
},
dubbo_invoker:invoke_request(?CURRENT_CLASS_NAME,Request).
dubbo_invoker:invoke_request(?CURRENT_CLASS_NAME,Request,RequestOption).


-spec queryUserInfo(Arg0::#userInfoRequest{})->
{ok,reference()}|
{ok,reference(),Data::#userInfo{},RpcContent::list()}|
{error,Reason::timeout|no_provider|any()}.
queryUserInfo(Arg0)->
queryUserInfo(Arg0 ,[]).
queryUserInfo(Arg0 ,#{}).

queryUserInfo(Arg0, Option)->
queryUserInfo(Arg0, RequestOption)->

Data = #dubbo_rpc_invocation{
className = ?CURRENT_CLASS_NAME,
@@ -143,22 +143,22 @@ queryUserInfo(Arg0, Option)->
Request = #dubbo_request{
is_event = false,
is_twoway = true,
mid = de_id_count:gen_id(),
mid = dubbo_id_generator:gen_id(),
data = Data,
mversion= <<"0.0.0">>,
serialize_type = ?SERIALIZATION_HESSIAN
},
dubbo_invoker:invoke_request(?CURRENT_CLASS_NAME,Request).
dubbo_invoker:invoke_request(?CURRENT_CLASS_NAME,Request,RequestOption).


-spec queryUserList(Arg0::list())->
{ok,reference()}|
{ok,reference(),Data::#userRes{},RpcContent::list()}|
{error,Reason::timeout|no_provider|any()}.
queryUserList(Arg0)->
queryUserList(Arg0 ,[]).
queryUserList(Arg0 ,#{}).

queryUserList(Arg0, Option)->
queryUserList(Arg0, RequestOption)->

Data = #dubbo_rpc_invocation{
className = ?CURRENT_CLASS_NAME,
@@ -181,10 +181,10 @@ queryUserList(Arg0, Option)->
Request = #dubbo_request{
is_event = false,
is_twoway = true,
mid = de_id_count:gen_id(),
mid = dubbo_id_generator:gen_id(),
data = Data,
mversion= <<"0.0.0">>,
serialize_type = ?SERIALIZATION_HESSIAN
},
dubbo_invoker:invoke_request(?CURRENT_CLASS_NAME,Request).
dubbo_invoker:invoke_request(?CURRENT_CLASS_NAME,Request,RequestOption).

0 comments on commit ae9c68f

Please sign in to comment.