cloud

package
v0.0.0-...-a73014c Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config Config) (*session.Session, error)

Types

type Attribute

type Attribute struct {
	Key   string
	Value string
	Type  string
}

type Config

type Config struct {
	Address string
	Region  string
	Profile string
	ID      string
	Secret  string
}

type Message

type Message struct {
	ID            string
	ReceiptHandle string
	Body          string
	Attributes    map[string]string
}

type MessageClient

type MessageClient interface {
	// Creates a new long polling queue and returns its URL.
	CreateQueue(ctx context.Context, queueName string, isDLX bool) (string, error)
	// Get a queue ARN.
	QueueARN(ctx context.Context, queueURL string) (string, error)
	// Binds a DLX queue to a normal queue.
	BindDLX(ctx context.Context, queueURL, dlxARN string) error
	// Send a message to queue and returns its message ID.
	Send(ctx context.Context, req *SendRequest) (string, error)
	// Long polls given amount of messages from a queue.
	Receive(ctx context.Context, queueURL string) (*Message, error)
	// Deletes a message from a queue.
	Delete(ctx context.Context, queueURL, rcvHandle string) error
}

type SQS

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

func NewSQS

func NewSQS(session *session.Session, timeout time.Duration) SQS

func (SQS) BindDLX

func (s SQS) BindDLX(ctx context.Context, queueURL, dlxARN string) error

func (SQS) CreateQueue

func (s SQS) CreateQueue(ctx context.Context, queueName string, isDLX bool) (string, error)

func (SQS) Delete

func (s SQS) Delete(ctx context.Context, queueURL, rcvHandle string) error

func (SQS) QueueARN

func (s SQS) QueueARN(ctx context.Context, queueURL string) (string, error)

func (SQS) Receive

func (s SQS) Receive(ctx context.Context, queueURL string) (*Message, error)

func (SQS) Send

func (s SQS) Send(ctx context.Context, req *SendRequest) (string, error)

type SQSConfig

type SQSConfig struct {
	Address   string
	Region    string
	Profile   string
	AwsKey    string
	AwsSecret string
	QueueName string
}

SQSConfig struct holds the basic config details of SQS Queue

func NewConfig

func NewConfig() *SQSConfig

New config Constructor

type SendRequest

type SendRequest struct {
	QueueURL   string
	Body       string
	Attributes []Attribute
}

Jump to

Keyboard shortcuts

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