Documentation
¶
Overview ¶
A client for a downstream HTTP service that can do work.
Once the dequeuer takes jobs out of the database, it needs to do some work and then report whether the work was successful or not. We do this by making a HTTP request to a downstream service that doesn't have any state built in, it just performs work when it's told to do so.
This package contains a client for making requests to that downstream service. For example usage, check the example in this file or JobProcessor in the services package.
Example ¶
Create a new client, then make a request to a downstream service with an empty data object.
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var Logger *log.Logger
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { *rest.Client Job *JobService }
The DownstreamClient is an API client for a downstream service that can handle POST requests to /v1/jobs/:job-name/:job-id. The service is expected to return a 202 and then make a callback to the job scheduler when the job has finished running.
type JobParams ¶
type JobParams struct { Data json.RawMessage `json:"data"` Attempts uint8 `json:"attempts"` }
type JobService ¶
type JobService struct {
Client *Client
}
func (*JobService) Post ¶
func (j *JobService) Post(name string, id *types.PrefixUUID, jp *JobParams) error
Post makes a request to /v1/jobs/:job-name/:job-id with the job data. The downstream service is expected to respond with a 202, so there is no positive return value, only nil if the response was a 2xx status code.
Directories
¶
Path | Synopsis |
---|---|
The downstream-server is a Go server that can dequeue jobs and hit the callback.
|
The downstream-server is a Go server that can dequeue jobs and hit the callback. |