https://github.com/kruglov-dmitry/akka_http_actor_demo
Example of simple web REST-service on top of akka http with dedicated dispatchers for blocking operations
https://github.com/kruglov-dmitry/akka_http_actor_demo
akka-http rest-api scala
Last synced: about 1 month ago
JSON representation
Example of simple web REST-service on top of akka http with dedicated dispatchers for blocking operations
- Host: GitHub
- URL: https://github.com/kruglov-dmitry/akka_http_actor_demo
- Owner: kruglov-dmitry
- Created: 2018-11-12T07:57:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-12T10:12:15.000Z (almost 7 years ago)
- Last Synced: 2025-01-19T09:12:06.351Z (over 1 year ago)
- Topics: akka-http, rest-api, scala
- Language: Scala
- Size: 11.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Requirements
JDK 8 or above
SBT 0.13.17
### Assumptions
1) username and password ascii strings without special symbols
2) settings of parallelism will be defined by cfg file via deployment section for particular actors
3) API endpoints will receive & return data in plain json format
4) no security
### How to build
```bash
sbt assembly
```
will create fat jar with all dependencies at `target/scala-2.11/akka_http_actor_demo-assembly-1.0.0.jar`
### How to run
1) edit cfg file at conf/app.conf
2) execute start.sh by invoking sh start.sh
3) use following endpoints to validate requests:
```bash
curl -w "\n" -XGET 'http://localhost:8080/healthcheck'
curl --header "Content-Type: application/json" \
--request POST \
--data '{"username":"A","password":"A"}' \
http://localhost:8080/v1/auth
curl --header "Content-Type: application/json" \
--request POST \
--data '{"username":"B","password":"A"}' \
http://localhost:8080/v1/auth
curl --header "Content-Type: application/json" \
--request POST \
--data '{"username":"B","password":"B"}' \
http://localhost:8080/v1/auth
curl -v --header "Content-Type: application/json" \
--request POST \
--data '{"username":"B"}' \
http://localhost:8080/v1/auth
```
If you want to run multiple simultaneous requests you may rely on simple python scripts:
by default it send 1k request and print their results
```bash
cd load_test
pip install -r requirements.txt
python run_load.py
```
### Notes
NOTE: in case you have encrypted home folder or mounted volume(s)
you may need to run following commands before assembling and after every
```bash
sbt clean:
```
```bash
rm -rf ./target
mkdir /tmp/`echo $$`
ln -s /tmp/`echo $$` ./target
```