retry

package
v0.0.0-...-279ef49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackMsg

type CallbackMsg struct {
	Host         string        `json:"host"`
	Path         string        `json:"path"`
	Heads        http.Header   `json:"heads"`
	PostForm     url.Values    `json:"params"`
	Body         []byte        `json:"body"`
	FirstDelayed time.Duration `json:"firstDelayed"` // 首次发送延迟时间
	Delayed      time.Duration `json:"delayed"`      // 延迟时间
	TotalTimes   int           `json:"totalTimes"`   // 重试次数
	OrderID      string        `json:"orderId"`
	Method       string        `json:"method"` // 发送到同程的请求method
	Times        int           `json:"times"`  // 重试次数
	TraceId      string        `json:"traceId"`
}

CallbackMsg URL 消息发送地址 Heads 请求头 PostForm post请求表单值 Body字段不为空才使用PostForm Content-Type 默认使用 head 里 Content-Type 的值,如果为空,默认值为:application/x-www-form-urlencoded Body Content-Type 默认使用 head 里 Content-Type 的值,如果为空,按以下规则设置 Struct Map Slice Content-Type 自动使用 "application/json" String Content-Type 自动使用 "text/plain; charset=utf-8" []byte Content-Type 使用 http.DetectContentType 来探测 Content-Type 的值 FirstDelayed 首次发送延迟时间 Delayed 每次发送的延迟时间 Times 当前发送次数 TotalTimes 总共发送次数,默认和 Times 相同,0 表示未收到正确的回复时,一直重试

type KeyValue

type KeyValue struct {
	Key string `json:"key"`
	Val string `json:"val"`
}

type Retry

type Retry struct {
	// contains filtered or unexported fields
}

func New

func New(client *resty.Client, amqpUrl string, logger log.Logger, tag string, checker func(msg CallbackMsg, v []byte) bool, debug bool) (*Retry, error)

func (*Retry) Send

func (r *Retry) Send(msg CallbackMsg) error

func (*Retry) Shutdown

func (r *Retry) Shutdown()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL