diff options
Diffstat (limited to 'plugins/jobs/structs/job.go')
-rw-r--r-- | plugins/jobs/structs/job.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/plugins/jobs/structs/job.go b/plugins/jobs/structs/job.go index 2e394543..268444db 100644 --- a/plugins/jobs/structs/job.go +++ b/plugins/jobs/structs/job.go @@ -17,19 +17,35 @@ type Job struct { Options *Options `json:"options,omitempty"` } +func (j *Job) ID() string { + return j.Options.ID +} + +func (j *Job) Priority() uint64 { + return *j.Options.Priority +} + // Body packs job payload into binary payload. func (j *Job) Body() []byte { return utils.AsBytes(j.Payload) } // Context packs job context (job, id) into binary payload. -func (j *Job) Context(id string) []byte { +func (j *Job) Context() []byte { ctx, _ := json.Marshal( struct { ID string `json:"id"` Job string `json:"job"` - }{ID: id, Job: j.Job}, + }{ID: j.Options.ID, Job: j.Job}, ) return ctx } + +func (j *Job) Ack() { + +} + +func (j *Job) Nack() { + +} |