jobHandler

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

README

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

Run in Postman

Endpoints
  • /ping
curl --location --request GET '172.17.0.2:8000/ping'

{
    "Status": true,
    "Data": "Pong"
}
  • /upload
curl --location --request POST '172.17.0.2:8000/upload' \
--form 'file=@pathToCSV.csv'

{
    "Status": true,
    "Data": "3f7d7db0-8054-445b-b2b3-78cd4b407dda"
}
  • /pause
curl --location --request GET '172.17.0.2:8000/pause?id=3f7d7db0-8054-445b-b2b3-78cd4b407dda'

{
    "Status": true,
    "Data": "job paused successfully"
}
  • /resume
curl --location --request GET '172.17.0.2:8000/resume?id=3f7d7db0-8054-445b-b2b3-78cd4b407dda'

{
    "Status": true,
    "Data": "job resumed successfully"
}
  • /terminate
curl --location --request GET '172.17.0.2:8000/terminate?id=3f7d7db0-8054-445b-b2b3-78cd4b407dda'

{
    "Status": true,
    "Data": "job paused successfully"
}
  • /status
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

  • Downloading dependencies
$ go mod download
  • Running the server
$ go run main.go

License

This software is licensed under Apache-2.0. Copyright Postman, Inc. See the LICENSE file for more information.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
api
job

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL