iq

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageAttributeReqID string = "x_req_id"
)

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(ctx context.Context) *zap.Logger

func GetUniqueName

func GetUniqueName() string

Types

type Config

type Config struct {
	Prefix                 string   `split_words:"true" required:"true"`
	TopicArns              []string `split_words:"true" required:"true"`
	MaxNumberOfMessages    int64    `split_words:"true" default:"10"`
	WaitTimeSecond         int64    `split_words:"true" default:"20"`
	VisibilityTimeout      int64    `split_words:"true" default:"3600"`
	DeliveryDelay          int64    `split_words:"true" default:"0"`
	MessageRetentionPeriod int64    `split_words:"true" default:"3600"`
	HandlerTimeout         int64    `split_words:"true" default:"60"`
}

type Handler

type Handler interface {
	HandleMessage(ctx context.Context, msg *M) error
}

type HandlerFunc

type HandlerFunc func(ctx context.Context, msg *M) error

HandlerFunc is used to define the Handler that is run on for each message

func (HandlerFunc) HandleMessage

func (f HandlerFunc) HandleMessage(ctx context.Context, msg *M) error

HandleMessage wraps a function for handling sqs messages

type InstanceQ

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

func NewInstanceQ

func NewInstanceQ(instanceName string, sess *session.Session, c *Config) (*InstanceQ, error)

func (*InstanceQ) Start

func (q *InstanceQ) Start(ctx context.Context, h Handler) error

func (*InstanceQ) Stop

func (q *InstanceQ) Stop()

type M

type M struct {
	Notification  NotificationMessage
	ReceiptHandle string
	Body          map[string]interface{}
	ID            string
	RawBody       []byte
}

type MessageAttribute

type MessageAttribute struct {
	Type  string `json:"Type"`
	Value string `json:"Value"`
}

type NotificationMessage

type NotificationMessage struct {
	Type             string                      `json:"Type"`
	ID               string                      `json:"MessageId"`
	TopicArn         string                      `json:"TopicArn"`
	Body             string                      `json:"Message"`
	Timestamp        time.Time                   `json:"Timestamp"`
	SignatureVersion string                      `json:"SignatureVersion"`
	Signature        string                      `json:"Signature"`
	SigningCertURL   string                      `json:"SigningCertURL"`
	UnsubscribeURL   string                      `json:"UnsubscribeURL"`
	Attributes       map[string]MessageAttribute `json:"Attributes"`
}

Jump to

Keyboard shortcuts

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