https://www.codementor.io/projects/background-job-system-atx32exogo
Start the server:
go run *.go
This will start both the webserver and the jobs handler.
Open your preferred browser, reach the page localhost:8081
.
In this page, you can insert a job.
A job is composed by some parameters.
- a payload
- a payload content-type
- an endpoint
- a HTTP status code
- a due date
- and a friendly name for your eyes
A payload is what you need to elaborate. Ideally a JSON but you could send whatever you need.
The receiving server will be more happy if you tell it what kind of payload
you are going to send to it. Defaults to application/json
, change if needed.
The server who will receive this job and will digest. Jep, because this is a
forwarding server only. The dirty work is made by endpoint
s.
What, don't you have an endpoint to use for testing this?
I'll tell you a secret. The folder /_listener
contains a dummy web server ;)
The job handler will flag as done
a job if the endpoint
returns a HTTP
Status Code like the one you want.
This is the time when you want your job to be sent to the endpoint. Could be any date, even in two years. The job will be stored and execute when the time comes. You can also set a date in the past and the job will run ASAP.
This is for you. In the background, an UUID will be generated and used.
Here, with a paginator made both on server and client side, you will see everything you need to see. Select a job if you want to delete or run ASAP.
What do I mean with ASAP? As soon as possible, in this server means as far as the tick clocks, and this happens every minute.
For this test, Sqlite3 is used.
Todo ASAP.