jobHandler
An API build on GoLang for long running jobs which can pause, resume and terminate a specific job.
Table of Content
Installation
Buind and run from source
Get the source using go get
$ go get github.com/someshkoli/jobHandler
$ $GOPATH/bin/jobHandler
Building and run in Docker
Build docker image
docker build -t jobhandler
Runnin Docker Image
docker run -it -p 8080:8000 jobhandler
Usage
- The server by default serves at http port 8000
Endpoints
curl --location --request GET '172.17.0.2:8000/ping'
{
"Status": true,
"Data": "Pong"
}
curl --location --request POST '172.17.0.2:8000/upload' \
--form 'file=@pathToCSV.csv'
{
"Status": true,
"Data": "3f7d7db0-8054-445b-b2b3-78cd4b407dda"
}
curl --location --request GET '172.17.0.2:8000/pause?id=3f7d7db0-8054-445b-b2b3-78cd4b407dda'
{
"Status": true,
"Data": "job paused successfully"
}
curl --location --request GET '172.17.0.2:8000/resume?id=3f7d7db0-8054-445b-b2b3-78cd4b407dda'
{
"Status": true,
"Data": "job resumed successfully"
}
curl --location --request GET '172.17.0.2:8000/terminate?id=3f7d7db0-8054-445b-b2b3-78cd4b407dda'
{
"Status": true,
"Data": "job paused successfully"
}
curl --location --request GET '172.17.0.2:8000/status?id=3f7d7db0-8054-445b-b2b3-78cd4b407dda'
{
"Status": true,
"Data": "Terminated"
}
Development
- This command will fetch the source to your local system
$ go get github.com/someshkoli/jobHandler
This will be saved in your $GOPATH/src/github.com/someshkoli/jobHandler
$ go mod download
$ go run main.go
License
This software is licensed under Apache-2.0. Copyright Postman, Inc. See the LICENSE file for more information.