amqp

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCodecNotProvided indicates that no codec was provided to the client.
	ErrCodecNotProvided = errors.New("codec not provided")
	// ErrApplyOption indicates that applying a ClientOption failed.
	ErrApplyOption = errors.New("amqp: failed to apply client option")
	// ErrTLSPairLoad indicates that loading the TLS certificate/key pair failed.
	ErrTLSPairLoad = errors.New("amqp: failed to load TLS key pair")
	// ErrCARead indicates that reading the CA certificate file failed.
	ErrCARead = errors.New("amqp: failed to read CA certificate file")
	// ErrInvalidCACert indicates that the CA certificate PEM could not be parsed.
	ErrInvalidCACert = errors.New("amqp: invalid CA certificate")
	// ErrConnectInProgress indicates that a connection attempt is already in progress.
	ErrConnectInProgress = errors.New("amqp: connection already in progress")
	// ErrReconnectFailed indicates that the reconnection attempt has failed.
	ErrReconnectFailed = errors.New("amqp: reconnection failed")
)

Functions

This section is empty.

Types

type Client added in v0.3.0

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

Client sends and receives messages using the AMQP protocol.

func NewClient

func NewClient(ctx context.Context, codec orbital.Codec, connInfo ConnectionInfo, opts ...ClientOption) (*Client, error)

NewClient initializes and returns a new AMQP client instance configured with the provided codec for encoding and decoding messages, connection information (URL, target, and source), and optional client options.

func (*Client) Close added in v0.3.0

func (c *Client) Close(ctx context.Context) error

Close closes the AMQP connection, sender, and receiver.

func (*Client) ReceiveTaskRequest added in v0.3.0

func (c *Client) ReceiveTaskRequest(ctx context.Context) (orbital.TaskRequest, error)

ReceiveTaskRequest receives, decodes and acknowledges a TaskRequest message.

func (*Client) ReceiveTaskResponse added in v0.3.0

func (c *Client) ReceiveTaskResponse(ctx context.Context) (orbital.TaskResponse, error)

ReceiveTaskResponse receives, decodes and acknowledges a TaskResponse message.

func (*Client) SendTaskRequest added in v0.3.0

func (c *Client) SendTaskRequest(ctx context.Context, req orbital.TaskRequest) error

SendTaskRequest sends an encoded TaskRequest message.

func (*Client) SendTaskResponse added in v0.3.0

func (c *Client) SendTaskResponse(ctx context.Context, resp orbital.TaskResponse) error

SendTaskResponse sends an encoded TaskResponse message.

type ClientOption

type ClientOption func(*amqp.ConnOptions) error

ClientOption configures how the AMQP connection is established.

func WithBasicAuth

func WithBasicAuth(username, password string) ClientOption

WithBasicAuth tells the client to use SASL PLAIN with user/password.

func WithExternalMTLS

func WithExternalMTLS(certFile, keyFile, caFile, serverName string) ClientOption

WithExternalMTLS sets up mutual TLS + SASL EXTERNAL authentication.

func WithNoAuth

func WithNoAuth() ClientOption

WithNoAuth tells the client to use SASL ANONYMOUS (no credentials).

func WithProperties

func WithProperties(props map[string]any) ClientOption

WithProperties lets you set custom connection properties (e.g., vpn-name).

type ConnectionInfo

type ConnectionInfo struct {
	URL    string
	Target string
	Source string
}

ConnectionInfo holds the connection details for the AMQP client.

Jump to

Keyboard shortcuts

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