retry2

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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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(amqpUrl string, logger log.Logger, exchangeName, queueName string, concurrent int, handler func(msg *RetryMsg) error) (*Retry, error)

func (*Retry) Publish

func (r *Retry) Publish(msg *RetryMsg) error

func (*Retry) Shutdown

func (r *Retry) Shutdown()

type RetryMsg

type RetryMsg struct {
	Host            string        `json:"host"`
	Path            string        `json:"path"`
	Heads           http.Header   `json:"heads"`
	Body            []byte        `json:"body"`
	FirstDelayed    time.Duration `json:"firstDelayed"` // 首次发送延迟时间
	Delayed         time.Duration `json:"delayed"`      // 延迟时间
	TotalTimes      int           `json:"totalTimes"`   // 重试次数
	CreateAt        time.Time     `json:"createAt"`     // 创建时间
	OrderID         string        `json:"orderID"`
	Method          string        `json:"method"`          // 发送到同程的请求method
	LastPublishTime time.Time     `json:"lastPublishTime"` // 上次发送时间
	Times           int           `json:"times"`           // 重试次数
	TraceID         string        `json:"traceID"`         // 每次请求的
}

CallbackMsg Host 消息发送地址 Path 消息发送地址utl path Heads 请求头 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 表示未收到正确的回复时,一直重试

Jump to

Keyboard shortcuts

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