Documentation ¶
Index ¶
- func Init()
- type Application
- type IncomingJob
- func (job *IncomingJob) Category() string
- func (job *IncomingJob) DecodePayload() error
- func (job *IncomingJob) NextDelay() uint64
- func (job *IncomingJob) Payload() string
- func (job *IncomingJob) RetryCount() uint
- func (job *IncomingJob) RetryDelay() uint
- func (job *IncomingJob) Timeout() uint
- func (job *IncomingJob) URL() string
- type PushResult
- type Service
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Application ¶
type Application struct { AccessLogWriter io.Writer Version string Service Service QueueRepository repository.QueueRepository RoutingRepository repository.RoutingRepository }
Application is an interface of the application.
func (*Application) Serve ¶
func (app *Application) Serve()
Serve starts the application Web server.
type IncomingJob ¶
type IncomingJob struct { CategoryField string `json:"category"` URLField string `json:"url"` PayloadField json.RawMessage `json:"payload"` RunAfterField uint `json:"run_after"` // seconds TimeoutField uint `json:"timeout"` // seconds RetryDelayField uint `json:"retry_delay"` // seconds MaxRetriesField uint `json:"max_retries"` // contains filtered or unexported fields }
IncomingJob describes a job to be pushed in a queue.
func (*IncomingJob) Category ¶
func (job *IncomingJob) Category() string
Category returns the category of the job.
func (*IncomingJob) DecodePayload ¶
func (job *IncomingJob) DecodePayload() error
DecodePayload decodes PayloadField of the job.
If PayloadField starts and ends with ", then it is decoded as a JSON string. If PayloadField is "null" then it is decoded to an empty string. Otherwise, the decoded value is the raw string of PayloadField.
The decoded value can be retrieved by Payload() method.
func (*IncomingJob) NextDelay ¶
func (job *IncomingJob) NextDelay() uint64
NextDelay returns the delay for a next try of the job.
func (*IncomingJob) Payload ¶
func (job *IncomingJob) Payload() string
Payload returns a decoded value of PayloadField.
func (*IncomingJob) RetryCount ¶
func (job *IncomingJob) RetryCount() uint
RetryCount returns the max retries of the job.
func (*IncomingJob) RetryDelay ¶
func (job *IncomingJob) RetryDelay() uint
RetryDelay returns the delay for retries of the job.
func (*IncomingJob) Timeout ¶
func (job *IncomingJob) Timeout() uint
Timeout returns the timeout of the job.
type PushResult ¶
type PushResult struct { ID uint64 `json:"id"` QueueName string `json:"queue_name"` IncomingJob }
PushResult describes a job pushed to a queue.
type Service ¶
type Service interface { Stop() <-chan struct{} GetJobQueue(qn string) (service.RunningQueue, bool) DeleteJobQueue(qn string) error AddJobQueue(q *model.Queue) error Push(job jobqueue.IncomingJob) (*service.PushResult, error) }
Service is an interface of the application use case service.