blob: fc255cfb86b6ec98cbdc216abd1ee90ea132c425 [file] [log] [blame]
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Apache Dubbo – Erlang</title><link>https://dubbo.apache.org/en/docs/v3.0/languages/erlang/</link><description>Recent content in Erlang on Apache Dubbo</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://dubbo.apache.org/en/docs/v3.0/languages/erlang/index.xml" rel="self" type="application/rss+xml"/><item><title>Docs: Quick start</title><link>https://dubbo.apache.org/en/docs/v3.0/languages/erlang/quick-start/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://dubbo.apache.org/en/docs/v3.0/languages/erlang/quick-start/</guid><description>
&lt;p>It is recommended to use java to define the interface jar first, and use the &lt;a href="https://github.com/apache/dubbo-erlang/tree/master/tools/erlanalysis">erlanalysis&lt;/a> tool to parse the java interface to Erlang lib&lt;/p>
&lt;h2 id="import-dependent-libraries">Import dependent libraries&lt;/h2>
&lt;h3 id="use-the-rebar-compilation-tool">Use the Rebar compilation tool.&lt;/h3>
&lt;p>Add dubblerl to rebar.config to your project&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-erlang" data-lang="erlang">&lt;span style="display:flex;">&lt;span>{deps, [
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> {dubboerl, {git, &lt;span style="color:#2aa198">&amp;#34;https://github.com/apache/dubbo-erlang.git&amp;#34;&lt;/span>, {branch, &lt;span style="color:#2aa198">&amp;#34;master&amp;#34;&lt;/span>}}}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>]}.
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="use-erlangmk-compilation-tool">Use erlang.mk compilation tool&lt;/h3>
&lt;p>&lt;code>in progress...&lt;/code>&lt;/p>
&lt;h2 id="import-interface-library">Import interface library&lt;/h2>
&lt;p>Suppose the interface lib you exported is called dubbo_service.&lt;/p>
&lt;ul>
&lt;li>If you didn&amp;rsquo;t upload your lib to your git repository, It is recommended that you copy the &lt;code>dubbo_service&lt;/code> lib
into the project&amp;rsquo;s &lt;code>apps&lt;/code> directory.&lt;/li>
&lt;li>If it is uploaded to your git repository, you can import like this:&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-erlang" data-lang="erlang">&lt;span style="display:flex;">&lt;span>{deps, [
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> {dubboerl, {git, &lt;span style="color:#2aa198">&amp;#34;https://github.com/apache/dubbo-erlang.git&amp;#34;&lt;/span>, {branch, &lt;span style="color:#2aa198">&amp;#34;master&amp;#34;&lt;/span>}}},
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> {dubbo_service,{git,&lt;span style="color:#2aa198">&amp;#34;${INTERFACE_LIB_URL}&amp;#34;&lt;/span>,{branch,&lt;span style="color:#2aa198">&amp;#34;master&amp;#34;&lt;/span>}}} &lt;span style="color:#586e75">%% replace ${INTERFACE_LIB_URL} with your lib git repos url
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#586e75">&lt;/span>]}.
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="consumer-configuration">Consumer configuration&lt;/h2>
&lt;p>Please reference &lt;a href="../reference/">Reference Config&lt;/a>&lt;/p>
&lt;h2 id="init-dubbolib-in-your-project">Init dubbolib in your project&lt;/h2>
&lt;p>It is need you&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-erlang" data-lang="erlang">&lt;span style="display:flex;">&lt;span>dubboerl:&lt;span style="color:#268bd2">init&lt;/span>().
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="how-to-call">How to call?&lt;/h2>
&lt;h3 id="synchronous-call">Synchronous call&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-erlang" data-lang="erlang">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">Request&lt;/span> &lt;span style="color:#719e07">=&lt;/span> #userInfoRequest{requestId &lt;span style="color:#719e07">=&lt;/span> &lt;span style="color:#2aa198">123&lt;/span>, username &lt;span style="color:#719e07">=&lt;/span> &lt;span style="color:#2aa198">&amp;#34;testname&amp;#34;&lt;/span>},
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>{ok,&lt;span style="color:#268bd2">RequestRef&lt;/span>,&lt;span style="color:#268bd2">Response&lt;/span>,&lt;span style="color:#268bd2">RpcContent&lt;/span>} &lt;span style="color:#719e07">=&lt;/span> userOperator:&lt;span style="color:#268bd2">queryUserInfo&lt;/span>(&lt;span style="color:#268bd2">Request&lt;/span>,#{sync&lt;span style="color:#719e07">=&amp;gt;&lt;/span> true}).
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If it occur error, is reponse &lt;code>{error,Reason}&lt;/code>.&lt;/p>
&lt;h3 id="asynchronous-call">Asynchronous call&lt;/h3>
&lt;p>Default is Async call.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-erlang" data-lang="erlang">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">Request&lt;/span> &lt;span style="color:#719e07">=&lt;/span> #userInfoRequest{requestId &lt;span style="color:#719e07">=&lt;/span> &lt;span style="color:#2aa198">123&lt;/span>, username &lt;span style="color:#719e07">=&lt;/span> &lt;span style="color:#2aa198">&amp;#34;testname&amp;#34;&lt;/span>},
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>{ok,&lt;span style="color:#268bd2">RequestRef&lt;/span>} &lt;span style="color:#719e07">=&lt;/span> userOperator:&lt;span style="color:#268bd2">queryUserInfo&lt;/span>(&lt;span style="color:#268bd2">Request&lt;/span>).
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#586e75">%% you can receive the message after.
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#586e75">&lt;/span>&lt;span style="color:#268bd2">handle_cast&lt;/span>({msg_back,&lt;span style="color:#268bd2">RequestRef&lt;/span>,&lt;span style="color:#268bd2">Response&lt;/span>,&lt;span style="color:#268bd2">RpcContent&lt;/span>},&lt;span style="color:#268bd2">State&lt;/span>).
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="example">Example&lt;/h2>
&lt;p>Refer to &lt;a href="https://github.com/apache/dubbo-erlang/tree/master/samples">dubboerl_demo&lt;/a>&lt;/p></description></item><item><title>Docs: Consumer configuration</title><link>https://dubbo.apache.org/en/docs/v3.0/languages/erlang/reference/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://dubbo.apache.org/en/docs/v3.0/languages/erlang/reference/</guid><description>
&lt;h2 id="basic-configuration">Basic configuration&lt;/h2>
&lt;p>Consumers need to add configuration items to &lt;code>sys.config&lt;/code> file &lt;code>dubboerl&lt;/code> filed.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-erlang" data-lang="erlang">&lt;span style="display:flex;">&lt;span>{dubboerl,[
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#586e75">%% other config ...
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#586e75">&lt;/span> {consumer,[
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> {&lt;span style="color:#719e07">&amp;lt;&amp;lt;&lt;/span>&lt;span style="color:#2aa198">&amp;#34;interface fullname&amp;#34;&lt;/span>&lt;span style="color:#719e07">&amp;gt;&amp;gt;&lt;/span>,[&lt;span style="color:#268bd2">Option&lt;/span>]},
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#586e75">%% eg:
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#586e75">&lt;/span> {&lt;span style="color:#719e07">&amp;lt;&amp;lt;&lt;/span>&lt;span style="color:#2aa198">&amp;#34;org.apache.dubbo.erlang.sample.service.facade.UserOperator&amp;#34;&lt;/span>&lt;span style="color:#719e07">&amp;gt;&amp;gt;&lt;/span>,[]},
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ]}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>]}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Option is to be added.&lt;/p></description></item><item><title>Docs: Provider configuration</title><link>https://dubbo.apache.org/en/docs/v3.0/languages/erlang/service/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://dubbo.apache.org/en/docs/v3.0/languages/erlang/service/</guid><description>
&lt;h2 id="basic-configuration">basic configuration&lt;/h2>
&lt;p>Provider configuration items to add to the &lt;code>sys.config&lt;/code> file &lt;code>dubboerl&lt;/code> field&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-erlang" data-lang="erlang">&lt;span style="display:flex;">&lt;span>{dubboerl,[
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#586e75">%% other config ...
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#586e75">&lt;/span> {provider,[
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> {module_implements,interface_module,interface_fullname,[&lt;span style="color:#268bd2">Options&lt;/span>]},
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#586e75">%% eg:
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#586e75">&lt;/span> {userOperator_impl,userOperator,&lt;span style="color:#719e07">&amp;lt;&amp;lt;&lt;/span>&lt;span style="color:#2aa198">&amp;#34;org.apache.dubbo.erlang.sample.service.facade.UserOperator&amp;#34;&lt;/span>&lt;span style="color:#719e07">&amp;gt;&amp;gt;&lt;/span>,[&lt;span style="color:#268bd2">Option&lt;/span>]}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ]}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>]}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;table>
&lt;thead>
&lt;tr>
&lt;th>ConfigName&lt;/th>
&lt;th>Type&lt;/th>
&lt;th>DefaultValue&lt;/th>
&lt;th>Remarks&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>module_implements&lt;/td>
&lt;td>atom()&lt;/td>
&lt;td>-&lt;/td>
&lt;td>The service implements module name&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>interface_module&lt;/td>
&lt;td>atom()&lt;/td>
&lt;td>-&lt;/td>
&lt;td>Interface module name is transfer form java jar&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>interface_fullname&lt;/td>
&lt;td>binary()&lt;/td>
&lt;td>-&lt;/td>
&lt;td>Interface full name is the java class name&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Option is to be added.&lt;/p></description></item><item><title>Docs: Serialized configuration items</title><link>https://dubbo.apache.org/en/docs/v3.0/languages/erlang/serialization/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://dubbo.apache.org/en/docs/v3.0/languages/erlang/serialization/</guid><description>
&lt;p>The library currently only implements the &lt;code>dubbo://&lt;/code> communication protocol.&lt;/p>
&lt;p>It supports &lt;code>hessian&lt;/code> and &lt;code>json&lt;/code> as serialization method.&lt;/p>
&lt;h2 id="configuration-example">Configuration example&lt;/h2>
&lt;p>Provider configuration items to add to the &lt;code>sys.config&lt;/code> file &lt;code>dubboerl&lt;/code> field.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-erlang" data-lang="erlang">&lt;span style="display:flex;">&lt;span>{dubboerl,[
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#586e75">%% other config ...
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#586e75">&lt;/span> {protocol,hessian}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>]}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;table>
&lt;thead>
&lt;tr>
&lt;th>ConfigName&lt;/th>
&lt;th>Type&lt;/th>
&lt;th>DefaultValue&lt;/th>
&lt;th>Remarks&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>protocol&lt;/td>
&lt;td>atom()&lt;/td>
&lt;td>hessian&lt;/td>
&lt;td>hessian,json&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table></description></item></channel></rss>