github.com/artisanhe/tools@v1.0.1-0.20210607022958-19a8fef2eb04/mq/interfaces.go (about) 1 package mq 2 3 type Broker interface { 4 SendTask(task *Task) (err error) 5 GetTask(channel string) (task *Task, err error) 6 } 7 8 type Canceller interface { 9 Cancel(id string) (err error) 10 IsCancelled(id string) (ok bool, err error) 11 ClearCancellation(id string) (err error) 12 } 13 14 type ChannelMgr interface { 15 ListChannel() (channelList []string, err error) 16 ListSubject(channel string) (subjectList []string, err error) 17 RegisterChannel(channel string, subjectList []string) error 18 } 19 20 type Backend interface { 21 Canceller 22 ChannelMgr 23 FeedBack(taskStatus *TaskStatus) (err error) 24 GetFeedback() (taskStatus *TaskStatus, err error) 25 } 26 27 type CronDescriber interface { 28 CronSpec() string 29 } 30 31 type MsgHead struct { 32 Channel string `json:"channel"` 33 Subject string `json:"subject"` 34 ID string `json:"id"` 35 }