on YouTube
why? whatsapp is a vangav backend template covering: service oriented architecture, worker service, multi-entry-point api, basic authentication and multi-keysapce database
- whatsapp, whatsapp worker and whatsapp analytics services work together and are generated using vangav backend
- 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.zipandvos_whatsapp_analytics.zipprojects (from the greenclone or downloadbutton) inside the workspace directory created previously (my_services) and unzip them - rename unzipped directories, remove the
-masterfrom their names - in the terminal
cdtovos_whatsapp/cassandra/cql/ - execute
./_start_cassandra.shto start cassandra cdtovos_whatsapp/cassandra/cql/drop_and_create/- execute the commands
./_execute_cql.sh wa_....cqlto initialize the services' database tables; repeat this step for all the.cqlfiles cdtovos_whatsapp_workerand execute./_run.shto start the whatsapp worker service on port 8000cdtovos_whatsapp_analyticsand execute./_run.sh 7000to start the whatsapp analytics service on port 7000cdtovos_whatsappand execute./_run.shto 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 + din the terminal session where each service was started in (9, 10 and 11) - to stop cassandra: execute
ps auwx | grep cassandrato get cassandra's(pid)thenkill -9 (pid)to stop cassandra
- follow the following steps to import the downloaded backend service in eclipse
cdto the service's directory and execute the./_eclipsify.shscript- 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
| controller(s) | feature |
|---|---|
| signup | handles new users' signup using phone numbers |
| send message | handles sending a message |
| get messages and get user info | handles getting new messages and users' info (id, name, ...) |
| controllers | feature |
|---|---|
| get users count and get messages count | handles fetching analytics data (total counts and count per-day) |
| reference | explanation |
|---|---|
| routes | api routes |
| controllers.json | api request/response's elements |
| wa_auth.keyspace | wa_auth is the keyspace used for all authentication-related tables |
| wa_users.keyspace | wa_users is the keyspace used for all users-info-related tables |
| wa_chat.keyspace | wa_chat is the keyspace used for all chat-related tables |
| wa_blobs.keyspace | wa_blobs is the keyspace used for all blobs-related tables |
| wa_analysis.keyspace | wa_analysis is the keyspace used for all analysis-related tables |
| common | handles controllers' common operations like authentication |
| controllers | api implementation |
| wa_auth | wa_auth cassandra's keyspace client |
| wa_users | wa_users cassandra's keyspace client |
| wa_chat | wa_chat cassandra's keyspace client |
| wa_blobs | wa_blobs cassandra's keyspace client |
| wa_analysis | wa_analysis cassandra's keyspace client |
| reference | explanation |
|---|---|
| routes | api routes |
| controllers.json | api request/response's elements |
| wa_analysis.keyspace | wa_analysis is the keyspace used for all analysis-related tables |
| controllers | api implementation |
| wa_analysis | wa_analysis cassandra's keyspace client |
- 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) |
| class | code : sub_code | explanation |
|---|---|---|
| HandlerGetMessagesCount | ||
| 400 : 1 | to-date is smaller than from-date | |
| HandlerGetUsersCount | ||
| 401 : 1 | to-date is smaller than from-date |
- whatsapp, whatsapp worker and whatsapp analytics services has no connection with WhatsApp Inc.; these services are just a vangav backend template to demonstrate using some features/utilities in the context of texting apps
- the "whatsapp" name is used for users to easier understand the services' design, features and source code





