Skip to content

Commit

Permalink
add english version for language section (3.0) (apache#994)
Browse files Browse the repository at this point in the history
Co-authored-by: Yunkun Huang <[email protected]>
  • Loading branch information
htynkn and Yunkun Huang authored Nov 25, 2021
1 parent 87872a1 commit 85531da
Show file tree
Hide file tree
Showing 10 changed files with 397 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ package-lock.json
.idea/

.DS_Store
/.hugo_build.lock
8 changes: 8 additions & 0 deletions content/en/docs/v3.0/languages/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

---
type: docs
title: "Multi-language implementation"
linkTitle: "multi-language"
weight: 60
description: "Dubbo support multi-language implementation, please learn about the special usage of each language"
---
9 changes: 9 additions & 0 deletions content/en/docs/v3.0/languages/erlang/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

---
type: docs
title: "Erlang"
linkTitle: "Erlang"
weight: 200
description: "Erlang support"
---

71 changes: 71 additions & 0 deletions content/en/docs/v3.0/languages/erlang/quick-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
type: docs
title: "Quick start "
linkTitle: "Quick start"
weight: 1
description: "Erlang Quick start"
---

It is recommended to use java to define the interface jar first, and use the [erlanalysis](https://github.com/apache/dubbo-erlang/tree/master/tools/erlanalysis) tool to parse the java interface to Erlang lib


## Import dependent libraries

### Use the Rebar compilation tool.

Add dubblerl to rebar.config to your project

```erlang
{deps, [
{dubboerl, {git, "https://github.com/apache/dubbo-erlang.git", {branch, "master"}}}
]}.
```

### Use erlang.mk compilation tool

`in progress...`

## Import interface library
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 uploaded 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 call?

### Synchronous 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}`.

### Asynchronous call

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).
```

## Example
Refer to [dubboerl_demo](https://github.com/apache/dubbo-erlang/tree/master/samples)
24 changes: 24 additions & 0 deletions content/en/docs/v3.0/languages/erlang/reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
type: docs
title: "Consumer configuration"
linkTitle: "Consumer configuration"
weight: 2
description: "Configure consumers in erlang"
---

## Basic configuration

Consumers need to add configuration items to `sys.config` file `dubboerl` filed.

```erlang
{dubboerl,[
%% other config ...
{consumer,[
{<<"interface fullname">>,[Option]},
%% eg:
{<<"org.apache.dubbo.erlang.sample.service.facade.UserOperator">>,[]},
]}
]}
```

Option is to be added.
26 changes: 26 additions & 0 deletions content/en/docs/v3.0/languages/erlang/serialization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
type: docs
title: "Serialized configuration items"
linkTitle: "Serialized configuration items"
weight: 4
description: "Configure the serialization method in erlang"
---

The library currently only implements the `dubbo://` communication protocol.

It supports `hessian` and `json` as serialization method.

## Configuration example

Provider configuration items to add to the `sys.config` file `dubboerl` field.

```erlang
{dubboerl,[
%% other config ...
{protocol,hessian}
]}
```

| ConfigName | Type | DefaultValue | Remarks |
| --- | --- | --- | --- |
| protocol | atom() | hessian | hessian,json |
30 changes: 30 additions & 0 deletions content/en/docs/v3.0/languages/erlang/service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
type: docs
title: "Provider configuration"
linkTitle: "Provider configuration"
weight: 3
description: "Configure service provider in erlang"
---

## basic configuration

Provider configuration items to add to the `sys.config` file `dubboerl` field

```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.
9 changes: 9 additions & 0 deletions content/en/docs/v3.0/languages/golang/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

---
type: docs
title: "golang"
linkTitle: "golang"
weight: 200
description: "golang support"
---

7 changes: 7 additions & 0 deletions content/en/docs/v3.0/languages/golang/go-specific.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
type: docs
title: "Go language definition service"
linkTitle: "Go language definition service"
weight: 10
description: ""
---
Loading

0 comments on commit 85531da

Please sign in to comment.