sfeng15 / ignite

Used Apache Ignite as DB. Web Service by Play Framework to allow CRUD operations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ignite-WS

Used Apache Ignite as DB + Web Service(Play Framework) to allow CRUD operations.

SBT tool is used for the project building.

How to start the project:

Prerequisites:

  1. Docker Compose should be installed.
  2. The project is tested with Docker Compose version 1.15.0. How to install the right veriosn, check here

Start (Prod mode)

  1. In the root project directory cd docker
  2. docker-compose up

Two images will be downloaded from github and launched:

  • turukin/ignite-ws
  • apacheignite/ignite

Starting dev mode

  1. In the root project directory cd docker
  2. docker-compose -f docker-compose-dev.yml up
  3. cd ../ignite-ws
  4. sbt run

In this case, apacheignite/ignite container is started with option network_mode: host. WS is started locally, without docker container.

WS API:

After starting the WS binds at port 9000

For POST operations Content-Type header param should be defined as application/json

API Methods

/cellUsers

Returns all users inside the specified cell

  • Request method: GET

  • Signature: /cellUsers/:cellId

  • Example:

    • localhost:9000/cellUsers/123qwe
    • localhost:9000/cellUsers/anotherCellId

/addUserToCell

Connets a specified user with a specified cell

  • Request method: POST

  • Signature: /addUserToCell

  • Example:
    localhost:9000/addUserToCell

    Request body:

{
  "ctn" : "+79521112233",
  "cellId" : "reallyNewCellID"
}

/addUserProfile

Adds new user profile

  • Request method: POST

  • Signature: /addUserProfile

  • Example:
    localhost:9000/addUserProfile

    Request body:

{
  "ctn" : "+79521112299",
  "name" : "new one user",
  "email" : "some@mail.com"
}

/populateTestData

Adds mock data.

For 123qwe cellId:

  {
    "ctn": "+79231112233",
    "name": "John",
    "email": "john@russinpost.ru",
    "activationDate": "2017-09-01 12:39:34"
   },
   {
    "ctn": "+79234445588",
    "name": "Alice",
    "email": "alice@russinpost.ru",
    "activationDate": "2017-09-01 12:39:34"
    }

For anotherCellId :

  {
    "ctn": "+79521112233",
    "name": "Mark",
    "email": "mark@pechkin.ru",
    "activationDate": "2017-09-01 12:39:34"
  },
  {
    "ctn": "+79524445588",
    "name": "Jane",
    "email": "jane@pechkin.ru",
    "activationDate": "2017-09-01 12:39:34"
  }
  • Request method: POST

  • Signature: /populateTestData

  • Example:
    localhost:9000/populateTestData

About

Used Apache Ignite as DB. Web Service by Play Framework to allow CRUD operations.


Languages

Language:Java 89.1%Language:Scala 10.9%