forked from RichardKnop/machinery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signature.go
44 lines (38 loc) · 911 Bytes
/
signature.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package tasks
import (
"fmt"
"time"
"github.com/satori/go.uuid"
)
// Arg represents a single argument passed to invocation fo a task
type Arg struct {
Type string
Value interface{}
}
// Headers represents the headers which should be used to direct the task
type Headers map[string]interface{}
// Signature represents a single task invocation
type Signature struct {
UUID string
Name string
RoutingKey string
ETA *time.Time
GroupUUID string
GroupTaskCount int
Args []Arg
Headers Headers
Immutable bool
RetryCount int
RetryTimeout int
OnSuccess []*Signature
OnError []*Signature
ChordCallback *Signature
}
// NewSignature creates a new task signature
func NewSignature(name string, args []Arg) *Signature {
return &Signature{
UUID: fmt.Sprintf("task_%v", uuid.NewV4()),
Name: name,
Args: args,
}
}