mqs

package
v0.1.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSQueue

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

func NewAWSQueue

func NewAWSQueue(config *AWSSQSConfig) *AWSQueue

func (*AWSQueue) Init

func (q *AWSQueue) Init(ctx context.Context) (func(), error)

func (*AWSQueue) InitSDK

func (q *AWSQueue) InitSDK(ctx context.Context) error

func (*AWSQueue) Publish

func (q *AWSQueue) Publish(ctx context.Context, incomingMessage IncomingMessage) error

func (*AWSQueue) Subscribe

func (q *AWSQueue) Subscribe(ctx context.Context) (Subscription, error)

type AWSSQSConfig

type AWSSQSConfig struct {
	Endpoint                  string // optional - dev-focused
	Region                    string
	ServiceAccountCredentials string
	Topic                     string
}

func (*AWSSQSConfig) ToCredentials

type AzureServiceBusConfig

type AzureServiceBusConfig struct {
}

type GCPPubSubConfig

type GCPPubSubConfig struct {
}

type InMemoryConfig

type InMemoryConfig struct {
	Name string
}

type InMemoryQueue

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

func NewInMemoryQueue

func NewInMemoryQueue(config *InMemoryConfig) *InMemoryQueue

func (*InMemoryQueue) Init

func (q *InMemoryQueue) Init(ctx context.Context) (func(), error)

func (*InMemoryQueue) Publish

func (q *InMemoryQueue) Publish(ctx context.Context, incomingMessage IncomingMessage) error

func (*InMemoryQueue) Subscribe

func (q *InMemoryQueue) Subscribe(ctx context.Context) (Subscription, error)

type IncomingMessage

type IncomingMessage interface {
	ToMessage() (*Message, error)
	FromMessage(msg *Message) error
}

type Message

type Message struct {
	QueueMessage
	Body []byte
}

type Policy

type Policy struct {
	VisibilityTimeout int // seconds
	RetryLimit        int
}

type Queue

type Queue interface {
	Init(ctx context.Context) (func(), error)
	Publish(ctx context.Context, msg IncomingMessage) error
	Subscribe(ctx context.Context) (Subscription, error)
}

func NewQueue

func NewQueue(config *QueueConfig) Queue

type QueueConfig

type QueueConfig struct {
	AWSSQS          *AWSSQSConfig
	AzureServiceBus *AzureServiceBusConfig
	GCPPubSub       *GCPPubSubConfig
	RabbitMQ        *RabbitMQConfig
	InMemory        *InMemoryConfig // mainly for testing purposes

	Policy Policy
}

func ParseQueueConfig

func ParseQueueConfig(viper *viper.Viper, prefix string) (*QueueConfig, error)

func (*QueueConfig) Validate

func (c *QueueConfig) Validate() error

type QueueMessage

type QueueMessage interface {
	Ack()
	Nack()
}

type RabbitMQConfig

type RabbitMQConfig struct {
	ServerURL string
	Exchange  string // optional
	Queue     string
}

type RabbitMQQueue

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

func NewRabbitMQQueue

func NewRabbitMQQueue(config *RabbitMQConfig) *RabbitMQQueue

func (*RabbitMQQueue) Init

func (q *RabbitMQQueue) Init(ctx context.Context) (func(), error)

func (*RabbitMQQueue) InitConn

func (q *RabbitMQQueue) InitConn() error

func (*RabbitMQQueue) Publish

func (q *RabbitMQQueue) Publish(ctx context.Context, incomingMessage IncomingMessage) error

func (*RabbitMQQueue) Subscribe

func (q *RabbitMQQueue) Subscribe(ctx context.Context) (Subscription, error)

type Subscription

type Subscription interface {
	Receive(ctx context.Context) (*Message, error)
	Shutdown(ctx context.Context) error
}

type UnimplementedQueue

type UnimplementedQueue struct{}

func (*UnimplementedQueue) Init

func (q *UnimplementedQueue) Init(ctx context.Context) (func(), error)

func (*UnimplementedQueue) Publish

func (*UnimplementedQueue) Subscribe

func (q *UnimplementedQueue) Subscribe(ctx context.Context) (Subscription, error)

type WrappedSubscription

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

func (*WrappedSubscription) Receive

func (s *WrappedSubscription) Receive(ctx context.Context) (*Message, error)

func (*WrappedSubscription) Shutdown

func (s *WrappedSubscription) Shutdown(ctx context.Context) error

Jump to

Keyboard shortcuts

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