Documentation
¶
Index ¶
- type Client
- func (d *Client) Delete(id string) (*Req, error)
- func (d *Client) Finish(id string) error
- func (d *Client) Get(id string) (*Req, error)
- func (d *Client) HandleAsync(topic string, queue <-chan *PopResp)
- func (d *Client) HandleSync(topic string, queue <-chan *PopResp) error
- func (d *Client) Pop(topic string) (pr *PopResp, err error)
- func (d *Client) Push(req *Req) (*Resp, error)
- func (d *Client) RoundPop(topic string, queue chan<- *PopResp) error
- func (d *Client) SetClient(client *http.Client)
- type PopResp
- type Req
- type Resp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// topic:handle
HandleMap map[string]func(*PopResp) error
// contains filtered or unexported fields
}
func (*Client) HandleAsync ¶
type Req ¶
type Req struct {
Topic string `json:"topic,omitempty"` // Job类型
Id string `json:"id,omitempty"` // Job唯一标识(确保job唯一)
Delay int64 `json:"delay,omitempty"` // Job需要延迟的时间, 单位:秒
TimeToRun int64 `json:"ttr,omitempty"` // Job执行超时时间, 单位:秒
Body string `json:"body,omitempty"` // Job的内容,供消费者做具体的业务处理,如果是json格式需转义
}
Click to show internal directories.
Click to hide internal directories.