Remove duplicated jaxrs library
[music.git] / examples / VotingApp / README.md
1 Compatible with MUSIC 2.5.3
2
3 The voting app for MUSIC  illustrates the features of MUSIC as a
4 multi-site state management
5 service. It is a program that
6 maintains state in MUSIC in the form of a vote-count table that has two columns, the candidateName
7 and his voteCount. To the external client that is using the voting app to update votes, the
8 votingApp provides a simple function to update the
9 votecount of the candidate in an exclusive manner. This is possible because of the locking service
10 in MUSIC. Since each candidate is a key in MUSIC, the votingapp simply acquires the geo-distributed
11 lock and only then upates the count. This guarantees correctness even when clients access different
12 end-points across data centers. Further since state is replicated correctly across data-centers,
13 even when one of the data centers fail, functioning can continue simply by using the MUSIC end point
14 in the other data center. 
15
16 The main function in the VotingApp.java is emulating clients from different data centers by randomly
17 chosing MUSIC end points. By updating vote counts
18 randomly using different MUSIC end points and still receiving the correct total count when doing a
19 read, the main function indicates the multi-site capability of MUSIC. 
20
21
22 To run the application, make sure you have onboarded the application using music's admin api.
23 A curl call using the default values would be:
24 curl -X POST \
25   http://localhost:8080/MUSIC/rest/v2/admin/onboardAppWithMusic \
26   -H 'Content-Type: application/json' \
27   -d '{
28 "appname"  : "votingapp",
29 "userId"   : "abc123d",
30 "password" : "password",
31 "isAAF"    : false
32 }'