amqp

package
v2.0.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// NewSession opens a new AMQP session to the server.
	NewSession(opts ...amqp.SessionOption) (Session, error)
	// Close disconnects the connection.
	Close() error
}

Client is an interface for the subset of go-amqp *Client functions that we actually use, adapted slightly to also interact with our own custom Session interface. Using these interfaces in our messaging abstraction, instead of using the go-amqp types directly, allows for the possibility of utilizing mock implementations for testing purposes. Adding only the subset of functions that we actually use limits the effort involved in creating such mocks.

func Dial

func Dial(addr string, opts ...amqp.ConnOption) (Client, error)

Dial connects to an AMQP server.

type Receiver

type Receiver interface {
	// Receive a Message.
	Receive(ctx context.Context) (*amqp.Message, error)
	// Close closes the Sender and AMQP link.
	Close(ctx context.Context) error
}

Receiver is an interface for the subset of go-amqp *Receiver functions that we actually use. Using this interface in our messaging abstraction, instead of using the go-amqp type directly, allows for the possibility of utilizing mock implementations for testing purposes. Adding only the subset of functions that we actually use limits the effort involved in creating such mocks.

type Sender

type Sender interface {
	// Send sends a Message.
	Send(ctx context.Context, msg *amqp.Message) error
	// Close closes the Sender and AMQP link.
	Close(ctx context.Context) error
}

Sender is an interface for the subset of go-amqp *Sender functions that we actually use. Using this interface in our messaging abstraction, instead of using the go-amqp type directly, allows for the possibility of utilizing mock implementations for testing purposes. Adding only the subset of functions that we actually use limits the effort involved in creating such mocks.

type Session

type Session interface {
	// NewSender opens a new sender link on the session.
	NewSender(opts ...amqp.LinkOption) (Sender, error)
	// NewReceiver opens a new receiver link on the session.
	NewReceiver(opts ...amqp.LinkOption) (Receiver, error)
	// Close gracefully closes the session.
	Close(ctx context.Context) error
}

Session is an interface for the subset of go-amqp *Session functions that we actually use, adapted slightly to also interact with our own custom Sender interface. Using these interfaces in our messaging abstraction, instead of using the go-amqp types directly, allows for the possibility of utilizing mock implementations for testing purposes. Adding only the subset of functions that we actually use limits the effort involved in creating such mocks.

Jump to

Keyboard shortcuts

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