why? whatsapp is a vangav backend template covering: service oriented architecture, worker service, multi-entry-point api, basic authentication and multi-keysapce database
- handles user signup and authentication
- sending messages
- fetching messages and users' info
- dispatching analytics writing to whatsapp worker
- handles writing analytics into the database
- handles fetching users' and messages' analytics
- this service is based on vangav backend's whatsapp template
- this service has the 90+% of the vangav backend's generated code + the 10-% of the logic code needed to complete the service
- for first timers - follow the steps in the system requirements tutorial
- for first timers - follow the steps in the workspace initialization tutorial
- download
vos_whatsapp.zip
, vos_whatsapp_worker.zip
and vos_whatsapp_analytics.zip
projects (from the green clone or download
button) inside the workspace directory created previously (my_services
) and unzip them
- rename unzipped directories, remove the
-master
from their names
- in the terminal
cd
to vos_whatsapp/cassandra/cql/
- execute
./_start_cassandra.sh
to start cassandra
cd
to vos_whatsapp/cassandra/cql/drop_and_create/
- execute the commands
./_execute_cql.sh wa_....cql
to initialize the services' database tables; repeat this step for all the .cql
files
cd
to vos_whatsapp_worker
and execute ./_run.sh
to start the whatsapp worker service on port 8000
cd
to vos_whatsapp_analytics
and execute ./_run.sh 7000
to start the whatsapp analytics service on port 7000
cd
to vos_whatsapp
and execute ./_run.sh
to start the whatsapp service on port 9000
- from your prefered client (we recommned postman) start trying the service; refer to the features and service references sections for reference
- at the end to stop the services: press
control + d
in the terminal session where each service was started in (9, 10 and 11)
- to stop cassandra: execute
ps auwx | grep cassandra
to get cassandra's (pid)
then kill -9 (pid)
to stop cassandra
- follow the following steps to import the downloaded backend service in eclipse
cd
to the service's directory and execute the ./_eclipsify.sh
script
- file > import > general > existing projects into workspace > next > set "select root directory" to my_services > under projects make sure that vos_calculate_sum is selected > finish
- double check the java version used for compiling the project: right click the project > properties > java compiler > enable project specific settings > compiler compliance level > 1.7 or 1.8
- generate multiple services (main + worker + analytics) to work together in a service oriented architecture
- generate a multi-keyspace database
- basic authentication
- this section lists the 10-% code added after vangav backend generated 90+% of the code
file/dir |
change |
common |
added common controllers' operations like authentication |
controllers |
added the implementation of request processing logic under controller_name/HandlerControllerName.java classes and nested response json structures under controller_name/response_json packages |
file/dir |
change |
controllers |
added the implementation of request processing logic under controller_name/HandlerControllerName.java classes and nested response json structures under controller_name/response_json packages |
- following are the error codes of whatsapp services
class |
code : sub_code |
explanation |
CommonPlayHandler |
|
|
|
300 : 1 |
user not signed up |
|
300 : 2 |
wrong password |
HandlerSignup |
|
|
|
301 : 1 |
user has no password |
|
301 : 2 |
wrong password |
HandlerGetUserInfo |
|
|
|
302 : 1 |
user not registered |
|
302 : 2 |
didn't find user's info |
HandlerSendMessage |
|
|
|
303 : 1 |
can't send message(s) to yourself |
|
303 : 2 |
message's recieving user isn't registered |
HandlerGetMessages |
|
|
|
304 : 1 |
didn't find message's blob (content) |