amqp

package
v0.0.0-...-ada256f Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	*instr.Instrumentation
	MessageTTL time.Duration
	// contains filtered or unexported fields
}

Channel wraps an AMQP channel

func (*Channel) Close

func (c *Channel) Close() error

Close closes a Channel

func (*Channel) Queue

func (c *Channel) Queue(ctx context.Context, name string) (*Queue, error)

Queue creates a named queue on a given chennel

type Config

type Config struct {
	URL           string
	MaxReconnect  int
	ReconnectTime time.Duration
	MessageTTL    time.Duration
}

Config specifies the configuration for an AMQP queue.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig generates a default configuration for an AMQP queue.

type Connection

type Connection struct {
	*instr.Instrumentation
	// contains filtered or unexported fields
}

Connection wraps an AMQP connection

func NewConnection

func NewConnection(ctx context.Context, cfg *Config, amqpConfig *amqp.Config, i *instr.Instrumentation) (*Connection, error)

NewConnection returns new AMQP connection

func (*Connection) Close

func (c *Connection) Close() error

Close closes the channel

func (*Connection) NewChannelQueue

func (c *Connection) NewChannelQueue(ctx context.Context, name string, prefetchCount int) (*Queue, error)

NewChannelQueue returns a new queue on a new channel

func (*Connection) String

func (c *Connection) String() string

type PublisherFactory

type PublisherFactory struct {
	*Config
	AMQPConfig *amqp.Config
	Queue      string
	*instr.Instrumentation
}

PublisherFactory automates creation of AMQP Publishers.

func (PublisherFactory) NewPublisher

func (f PublisherFactory) NewPublisher(ctx context.Context) (queue.Publisher, error)

NewPublisher generates a new publisher or returns an error.

type Queue

type Queue struct {
	*instr.Instrumentation
	// contains filtered or unexported fields
}

Queue wraps an channel/queue for tasks

func (*Queue) Consume

func (q *Queue) Consume(ctx context.Context) (<-chan amqp.Delivery, error)

Consume consumes messages from a queue

func (*Queue) Publish

func (q *Queue) Publish(ctx context.Context, params interface{}, priority uint8) error

Publish adds a task with specified params to the Queue priority: higher number, higher priority TODO: Add context parameter, allow for timeouts etc

func (*Queue) String

func (q *Queue) String() string

String returns the name of the queue

Jump to

Keyboard shortcuts

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