Skip to content

Latest commit

 

History

History
53 lines (51 loc) · 1.33 KB

README.md

File metadata and controls

53 lines (51 loc) · 1.33 KB

Task-processing

Prerequisites

  • JDK17

How to use API

Server listens on port 8080 by default

  • Method: POST
    URI: /tasks

Request body:

"base": double (required)
"exponent": double (required)

Response:

"id": long

Description:
Creates and runs task asynchronously, result of the task will be exponentation of "base" and "exponent". Returns unique id of the created task

  • Method: GET
    URI: /task/{id}

Response:

"id": long
"status": string (Possible values: QUEUED, RUNNING, FINISHED, ABORTED)
"progress": int (Values 0-100)
"result": double (Returned only when the task is completed)

Description:
Retrieves information about task with specified id. "result" is returned only when status is set to "FINISHED"

  • Method: GET
    URI: /tasks

Response:

[
  {
    "id": long
    "status": string (Possible values: QUEUED, RUNNING, FINISHED, ABORTED)
    "progress": int (Values 0-100)
    "result": double (Returned only when the task is completed)
  },
  ...
]

Description:
Retrieves information about all tasks. "result" is returned only when status is set to "FINISHED"

How to run

Run these commands in the project directory (JAVA_HOME environment variable needs to be set and pointing to JDK17)

./mvnw clean package
./mvnw spring-boot:run