-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoverview.edoc
More file actions
130 lines (93 loc) · 4.93 KB
/
overview.edoc
File metadata and controls
130 lines (93 loc) · 4.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
@author Gregoire Lejeune <gregoire.lejeune@gmail.com>
@author Gregoire Lejeune <greg@g-corp.io>
@copyright 2015 Grégoire Lejeune, 2015 G-Corp
@version 0.0.1
@title Microservice framework for Erlang
@doc
<h3>Create a microservice with wok</h3>
<h4>Erlang</h4>
1. Add wok in your dependencies :
<pre>
{wok, ".*", {git, "git@gitlab.botsunit.com:msaas/wok.git", {branch, "master"}}}
</pre>
2. Create your services and routes.
3. Reference your services and routes in the <tt>config</tt> file (see <a href="#conf">Configuration</a>)
3. Start your service :
<pre>
application:ensure_all_started(wok).
</pre>
<h4>Elixir</h4>
<h4>Ruby</h4>
<h4>Python</h4>
<h4>Javascript</h4>
<a name="conf"></a><h3>Configuration</h3>
<ul>
<li><tt>messages :: list()</tt> : <a href="#messages_conf">Messages configuration</a></li>
<li><tt>rest :: list()</tt> : <a href="#rest_conf">REST configuration</a></li>
</ul>
<a name="messages_conf"></a><h4>Messages configuration</h4>
<ul>
<li><tt>handler :: atom()</tt> : handler used to create and parse messages. See <a href="https://gitlab.botsunit.com/msaas/wok_message_handler">wok_message_handler</a> for more informations.</li>
<li><tt>services :: list()</tt> : <a href="#services_conf">Services configuration</a></li>
<li><tt>consumer_group :: binary() | random | {random, [{prefix, term()}]}</tt> : Name of the Kafka' consumer group</li>
<li><tt>local_queue_name :: binary()</tt> : Name of the pipette' queue</li>
<li><tt>local_consumer_group :: binary() | random | {random, [{prefix, term()}]}</tt> : Name of the pipette' consumer group</li>
<li><tt>max_services_fork :: integer()</tt> : Maximum number of messages in parallel</li>
<li><tt>topics :: list()</tt> : <a href="#topic_conf">Topics configuration</a></li>
<li><tt>from_beginning :: true | false</tt> : Start consuming from beginning (default true)</li>
</ul>
<a name="rest_conf"></a><h4>REST configuration</h4>
<ul>
<li><tt>port :: integer()</tt> : Port to use for the REST API (default: <tt>8080</tt>)</li>
<li><tt>ip :: list()</tt> : IP to use for the REST API (default: <tt>0.0.0.0</tt>)</li>
<li><tt>max_conn :: integer()</tt> : Max number of connexions (default: <tt>100</tt>)</li>
<li><tt>routes :: list()</tt> : <a href="#routes_conf">Routes configuration</a></li>
</ul>
<a name="services_conf"></a><h4>Services configuration</h4>
<pre>
{<<"my_service">>, {my_service_module, my_service_function}}
</pre>
<a name="topics_conf"></a><h4>Services configuration</h4>
<pre>
{<<"topic">>, [{fetch_frequency, 5000}, {max_bytes, 10485760}]}
</pre>
<a name="routes_conf"></a><h4>Routes configuration</h4>
<pre>
{'GET', "/path", {route_module, route_function}}
</pre>
<h3>Dependencies</h3>

<h3>Call tree</h3>

<h2>Start Kafka</h2>
Update <tt>docker-compose.yml</tt> and change <tt>KAFKA_ADVERTISED_HOST_NAME</tt> to the IP of your <tt>docker0</tt> interface.
<pre>
docker-compose up -d
kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 3 --topic test
kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 3 --topic repl
kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 3 --topic service
kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 3 --topic public
...
docker-compose stop
</pre>
<h3>Licence</h3>
<p>
Wok is available for use under the following license, commonly known as the 3-clause (or "modified") BSD license:
</p>
<p>
Copyright (c) 2015, G-Corp<br />
Copyright (c) 2015, 2016, 2017 BotsUnit<br />
</p>
<p>
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
</p>
<p>
<ul>
<li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li>
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li>
<li>The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.</li>
</ul>
</p>
<p>
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</p>