Documentation
¶
Overview ¶
Package amqpx holds the low-level AMQP plumbing shared by the publisher and consumer: connection dialing, exchange declaration, credential-safe URL masking, trace-context propagation, and the retry-count header. It is internal so the public API stays small and this layer can evolve freely.
Index ¶
Constants ¶
const RetryCountHeader = "x-retry-count"
RetryCountHeader is the message header tracking how many times a delivery has been retried in place.
Variables ¶
This section is empty.
Functions ¶
func DeclareExchange ¶
func DeclareExchange(conn *amqp.Connection, name, kind string) error
DeclareExchange declares a durable exchange of the given kind on a temporary channel.
func Dial ¶
func Dial(opts DialOptions) (*amqp.Connection, error)
Dial opens a new AMQP connection bounded by the dial and overall connection timeouts. The whole DialConfig call is raced against ConnectionTimeout so a stalled handshake cannot block startup indefinitely.
func MaskURL ¶
MaskURL replaces the password in an AMQP URL with "***" so the URL is safe to log. URLs without userinfo or without a password are returned unchanged.
func NextRetryHeaders ¶
NextRetryHeaders returns a copy of original with the retry counter set to count. It errors if count does not fit in the int32 AMQP header type.
func ReadRetryCount ¶
ReadRetryCount reads the retry counter from message headers, returning 0 when it is absent or of an unexpected type.
Types ¶
type DialOptions ¶
type DialOptions struct {
URL string
// TLSClientConfig enables TLS, custom CAs, or mTLS.
TLSClientConfig *tls.Config
// Heartbeat configures AMQP heartbeats. Leave zero for amqp091-go defaults.
Heartbeat time.Duration
// Locale configures the AMQP locale. Leave empty for amqp091-go defaults.
Locale string
// ClientProperties are sent during connection negotiation.
ClientProperties amqp.Table
// ConnectionName is sent as the RabbitMQ connection_name client property.
ConnectionName string
// SASL configures authentication mechanisms.
SASL []amqp.Authentication
// DialTimeout bounds the underlying TCP dial.
DialTimeout time.Duration
// ConnectionTimeout bounds the full AMQP handshake.
ConnectionTimeout time.Duration
}
DialOptions configures Dial.