Skip to content
Test Environment for the Apache Thrift Tutorial
Branch: master
Clone or download

README.md

Test Environment for the Apache Thrift Tutorial

Installation

1. clone this repository locally with git clone:

git clone https://github.com/walter-weinmann/erlang_thrift_tutorial

2. compile the Erlang code with rebar3:

cd erlang_thrift_tutorial
rebar3 compile

Operation

1. start Erlang with script start_erlang.bat before starting the Erlang server or Erlang client:

...>start_erlang
Starting Server EBIN Path : -pa D:\SoftDevelopment\Projects\erlang_thrift_tutorial_idea\erlang_thrift_tutorial\_build\default\lib\jsx\ebin D:\SoftDevelopment\Projects\erlang_thrift_tutorial_idea\erlang_thrift_tutorial\_build\default\lib\thrift\ebin D:\SoftDevelopment\Projects\erlang_thrift_tutorial_idea\erlang_thrift_tutorial\_build\default\lib\tutorial\ebin
Eshell V9.0  (abort with ^G)
1>

2. start the Erlang server inside Erlang with the function server:start:

1> server:start().
  
=INFO REPORT==== 5-Sep-2017::13:37:24 ===
thrift service listening on port 9090{ok,<0.60.0>}

3. start the Erlang client inside Erlang with the function client:t:

1> client:t().
ping
1+1=2
1+4=5
15-10=5
Log: {'SharedStruct',1,<<"RARG">>}
Got exception where expecting - the following is NOT a problem!!!
{exception,{'InvalidOperation',4,<<"Cannot divide by 0">>}}
zip
ok

4. start the Python server with the command python src_py\PythonServer.py:

...>python src_py\PythonServer.py
Starting the server...

5. start the Python client with the command python src_py\PythonClient.py:

...>python src_py\PythonClient.py
ping()
1+1=2
InvalidOperation: InvalidOperation(whatOp=4, why='Cannot divide by 0')
15-10=5
Check log: 5

Client Test Results

1. Erlang Server and Erlang Client:

ping
1+1=2
1+4=5
15-10=5
Log: {'SharedStruct',1,<<"RARG">>}
Got exception where expecting - the following is NOT a problem!!!
{exception,{'InvalidOperation',4,<<"Cannot divide by 0">>}}
zip
ok

2. Erlang Server and Python Client:

ping()
1+1=2
InvalidOperation: InvalidOperation(whatOp=4, why='Cannot divide by 0')
15-10=5
Check log: 5

3. Python Server and Erlang Client

** exception error: no match of right hand side value {error,econnrefused}
     in function  client:t/0 (d:/TempMan/erlang_thrift_tutorial/_build/default/lib/tutorial/src/client.erl, line 33)

4. Python Server and Python Client

ping()
1+1=2
InvalidOperation: InvalidOperation(whatOp=4, why='Cannot divide by 0')
15-10=5
Check log: 5
You can’t perform that action at this time.