Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) ReceiveTaskRequest(ctx context.Context) (orbital.TaskRequest, error)
- func (c *Client) ReceiveTaskResponse(ctx context.Context) (orbital.TaskResponse, error)
- func (c *Client) SendTaskRequest(ctx context.Context, req orbital.TaskRequest) error
- func (c *Client) SendTaskResponse(ctx context.Context, resp orbital.TaskResponse) error
- type ClientOption
- type ConnectionInfo
Constants ¶
This section is empty.
Variables ¶
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) ReceiveTaskRequest ¶ added in v0.3.0
ReceiveTaskRequest receives, decodes and acknowledges a TaskRequest message.
func (*Client) ReceiveTaskResponse ¶ added in v0.3.0
ReceiveTaskResponse receives, decodes and acknowledges a TaskResponse message.
func (*Client) SendTaskRequest ¶ added in v0.3.0
SendTaskRequest sends an encoded TaskRequest message.
func (*Client) SendTaskResponse ¶ added in v0.3.0
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 ¶
ConnectionInfo holds the connection details for the AMQP client.