This is an automated email from the ASF dual-hosted git repository. huxing pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/dubbo-website.git
The following commit(s) were added to refs/heads/asf-site by this push: new 72c4883 Add dubbo-erlang user doc (#382) 72c4883 is described below commit 72c4883a59dc404a8676a8efc50353c10f413e2d Author: DLive <xsxgm...@163.com> AuthorDate: Fri May 31 07:22:05 2019 +0800 Add dubbo-erlang user doc (#382) --- docs/en-us/user/languages/erlang/reference.md | 15 ++++++ docs/en-us/user/languages/erlang/serialization.md | 17 +++++++ docs/en-us/user/languages/erlang/service.md | 22 ++++++++ docs/en-us/user/languages/erlang/start.md | 62 +++++++++++++++++++++++ docs/zh-cn/user/languages/erlang/reference.md | 15 ++++++ docs/zh-cn/user/languages/erlang/serialization.md | 21 ++++++++ docs/zh-cn/user/languages/erlang/service.md | 22 ++++++++ docs/zh-cn/user/languages/erlang/start.md | 60 ++++++++++++++++++++++ site_config/docs.js | 42 +++++++++++++++ 9 files changed, 276 insertions(+) diff --git a/docs/en-us/user/languages/erlang/reference.md b/docs/en-us/user/languages/erlang/reference.md new file mode 100644 index 0000000..bb3bfcb --- /dev/null +++ b/docs/en-us/user/languages/erlang/reference.md @@ -0,0 +1,15 @@ +# Consumer Configurations + +## Base Config +Consumer config is under the dubboerl application with sys.config +```erlang +{dubboerl,[ + %% other config ... + {consumer,[ + {<<"interface fullname">>,[Option]}, + %% eg: + {<<"org.apache.dubbo.erlang.sample.service.facade.UserOperator">>,[]}, + ]} +]} +``` +Option is to be added. diff --git a/docs/en-us/user/languages/erlang/serialization.md b/docs/en-us/user/languages/erlang/serialization.md new file mode 100644 index 0000000..0603dcf --- /dev/null +++ b/docs/en-us/user/languages/erlang/serialization.md @@ -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 | + \ No newline at end of file diff --git a/docs/en-us/user/languages/erlang/service.md b/docs/en-us/user/languages/erlang/service.md new file mode 100644 index 0000000..86418ac --- /dev/null +++ b/docs/en-us/user/languages/erlang/service.md @@ -0,0 +1,22 @@ +# Provider Configurations + +## Base Config +Provider config is under the dubboerl application with sys.config +```erlang +{dubboerl,[ + %% other config ... + {provider,[ + {module_implements,interface_module,interface_fullname,[Options]}, + %% eg: + {userOperator_impl,userOperator,<<"org.apache.dubbo.erlang.sample.service.facade.UserOperator">>,[Option]} + ]} +]} +``` + +| ConfigName | Type | DefaultValue | Remarks | +| --- | --- | --- | --- | +| module_implements | atom() | - | The service implements module name| +| interface_module | atom() | - | Interface module name is transfer form java jar | +| interface_fullname | binary() | - | Interface full name is the java class name | + +Option is to be added. \ No newline at end of file diff --git a/docs/en-us/user/languages/erlang/start.md b/docs/en-us/user/languages/erlang/start.md new file mode 100644 index 0000000..b2e5d46 --- /dev/null +++ b/docs/en-us/user/languages/erlang/start.md @@ -0,0 +1,62 @@ +# Quick Start + +We recommend using java to define the Dubbo interface. And use [erlanalysis](https://github.com/apache/dubbo-erlang/tree/master/tools/erlanalysis) +tool parse java interface transfer to erlang lib. + +## Import Dependency Lib + + +### Using Rebar Build Tool +Add dubblerl to rebar.config with your project +```erlang +{deps, [ + {dubboerl, {git, "https://github.com/apache/dubbo-erlang.git", {branch, "master"}}} +]}. +``` + +### User erlang.mk Build Tool +`Waiting for improvement` + +## Import interface lib +Suppose the interface lib you exported is called dubbo_service. +* If you didn't upload your lib to your git repository, It is recommended that you copy the `dubbo_service` lib +into the project's `apps` directory. +* If it is upload to your git repository, you can import like this: +```erlang +{deps, [ + {dubboerl, {git, "https://github.com/apache/dubbo-erlang.git", {branch, "master"}}}, + {dubbo_service,{git,"${INTERFACE_LIB_URL}",{branch,"master"}}} %% replace ${INTERFACE_LIB_URL} with your lib git repos url +]}. +``` + +## Consumer Configuration +Please reference [Reference Config](./reference.md) + +## Init dubbolib in your project +It is need you +```erlang +dubboerl:init(). +``` + +## How to invoke? + +### Sync Call +```erlang +Request = #userInfoRequest{requestId = 123, username = "testname"}, +{ok,RequestRef,Response,RpcContent} = userOperator:queryUserInfo(Request,#{sync=> true}). +``` +If it occur error, is reponse `{error,Reason}`. + +### Async Call + +Default is Async call. +```erlang +Request = #userInfoRequest{requestId = 123, username = "testname"}, +{ok,RequestRef} = userOperator:queryUserInfo(Request). + +%% you can receive the message after. +{msg_back,RequestRef,Response,RpcContent}. +``` + +## Sample +Reference the demo project [dubboerl_demo](https://github.com/apache/dubbo-erlang/tree/master/samples) \ No newline at end of file diff --git a/docs/zh-cn/user/languages/erlang/reference.md b/docs/zh-cn/user/languages/erlang/reference.md new file mode 100644 index 0000000..25372a8 --- /dev/null +++ b/docs/zh-cn/user/languages/erlang/reference.md @@ -0,0 +1,15 @@ +# 消费者配置 + +## 基础配置 +消费者配置项需要添加到`sys.config`文件`dubboerl`应用配置项里。 +```erlang +{dubboerl,[ + %% other config ... + {consumer,[ + {<<"interface fullname">>,[Option]}, + %% eg: + {<<"org.apache.dubbo.erlang.sample.service.facade.UserOperator">>,[]}, + ]} +]} +``` +Option 配置项待添加中. diff --git a/docs/zh-cn/user/languages/erlang/serialization.md b/docs/zh-cn/user/languages/erlang/serialization.md new file mode 100644 index 0000000..250d87a --- /dev/null +++ b/docs/zh-cn/user/languages/erlang/serialization.md @@ -0,0 +1,21 @@ +# 序列化配置项 + +当前该库只实现了`dubbo://`通讯协议。 + +序列化方式实现了`hessian`和`json`两种方式。 + +## 配置样例 + +序列化配置需要添加到`sys.config`文件`dubboerl`应用配置项里。 + +```erlang +{dubboerl,[ + %% other config ... + {protocol,hessian} +]} +``` + +| ConfigName | Type | DefaultValue | Remarks | +| --- | --- | --- | --- | +| protocol | atom() | hessian | hessian,json | + \ No newline at end of file diff --git a/docs/zh-cn/user/languages/erlang/service.md b/docs/zh-cn/user/languages/erlang/service.md new file mode 100644 index 0000000..1d2c762 --- /dev/null +++ b/docs/zh-cn/user/languages/erlang/service.md @@ -0,0 +1,22 @@ +# 提供者配置 + +## 基本配置 +提供者配置项需要添加到`sys.config`文件`dubboerl`应用配置项里。 +```erlang +{dubboerl,[ + %% other config ... + {provider,[ + {module_implements,interface_module,interface_fullname,[Options]}, + %% eg: + {userOperator_impl,userOperator,<<"org.apache.dubbo.erlang.sample.service.facade.UserOperator">>,[Option]} + ]} +]} +``` + +| ConfigName | Type | DefaultValue | Remarks | +| --- | --- | --- | --- | +| module_implements | atom() | - | The service implements module name| +| interface_module | atom() | - | Interface module name is transfer form java jar | +| interface_fullname | binary() | - | Interface full name is the java class name | + +Option is to be added. \ No newline at end of file diff --git a/docs/zh-cn/user/languages/erlang/start.md b/docs/zh-cn/user/languages/erlang/start.md new file mode 100644 index 0000000..054d0f7 --- /dev/null +++ b/docs/zh-cn/user/languages/erlang/start.md @@ -0,0 +1,60 @@ +# 快速开始 + +建议先使用java定义接口jar,并使用[erlanalysis](https://github.com/apache/dubbo-erlang/tree/master/tools/erlanalysis) 工具解析java接口至Erlang lib + +## 导入依赖库 + +### 使用 Rebar 编译工具。 +Add dubblerl to rebar.config with your project +```erlang +{deps, [ + {dubboerl, {git, "https://github.com/apache/dubbo-erlang.git", {branch, "master"}}} +]}. +``` + +### 使用 erlang.mk 编译工具 +`待补充` + +## 导入接口库 +Suppose the interface lib you exported is called dubbo_service. +* If you didn't upload your lib to your git repository, It is recommended that you copy the `dubbo_service` lib +into the project's `apps` directory. +* If it is upload to your git repository, you can import like this: +```erlang +{deps, [ + {dubboerl, {git, "https://github.com/apache/dubbo-erlang.git", {branch, "master"}}}, + {dubbo_service,{git,"${INTERFACE_LIB_URL}",{branch,"master"}}} %% replace ${INTERFACE_LIB_URL} with your lib git repos url +]}. +``` + +## 消费者配置 +Please reference [Reference Config](./reference.md) + +## Init dubbolib in your project +It is need you +```erlang +dubboerl:init(). +``` + +## 如何调用? + +### 同步调用 +```erlang +Request = #userInfoRequest{requestId = 123, username = "testname"}, +{ok,RequestRef,Response,RpcContent} = userOperator:queryUserInfo(Request,#{sync=> true}). +``` +If it occur error, is reponse `{error,Reason}`. + +### 异步调用 + +Default is Async call. +```erlang +Request = #userInfoRequest{requestId = 123, username = "testname"}, +{ok,RequestRef} = userOperator:queryUserInfo(Request). + +%% you can receive the message after. +handle_cast({msg_back,RequestRef,Response,RpcContent},State). +``` + +## 示例 +参考项目 [dubboerl_demo](https://github.com/apache/dubbo-erlang/tree/master/samples) \ No newline at end of file diff --git a/site_config/docs.js b/site_config/docs.js index e2623e3..30867e0 100644 --- a/site_config/docs.js +++ b/site_config/docs.js @@ -405,6 +405,27 @@ export default { { title: 'Test coverage report', link: '/en-us/docs/user/coveragence.html' + }, + { + title: 'Erlang languages', + children: [ + { + title: 'Quick start', + link: '/en-us/docs/user/languages/erlang/start.html' + }, + { + title: 'Reference configuration', + link: '/en-us/docs/user/languages/erlang/reference.html' + }, + { + title: 'Service configuration', + link: '/en-us/docs/user/languages/erlang/service.html' + }, + { + title: 'Serialization configuration', + link: '/en-us/docs/user/languages/erlang/serialization.html' + } + ] } ], }, @@ -1044,6 +1065,27 @@ export default { link: '/zh-cn/docs/user/versions/version-270.html' } ] + }, + { + title: 'Erlang 语言', + children: [ + { + title: '快速启动', + link: '/zh-cn/docs/user/languages/erlang/start.html' + }, + { + title: '消费者配置', + link: '/zh-cn/docs/user/languages/erlang/reference.html' + }, + { + title: '提供者配置', + link: '/zh-cn/docs/user/languages/erlang/service.html' + }, + { + title: '序列化配置', + link: '/zh-cn/docs/user/languages/erlang/serialization.html' + } + ] } ], },