options

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConnectionOptions = ConnectionOptions{
	Scheme:   "amqp",
	Host:     "localhost",
	Port:     5672,
	Username: "guest",
	Password: "guest",
	Vhost:    "/",
}

Functions

This section is empty.

Types

type BindOptions

type BindOptions struct {
	RoutingKey string                 `yaml:"routing-key"`
	NoWait     bool                   `yaml:"no-wait"`
	Args       map[string]interface{} `yaml:"args"`
}

type ConnectionOption

type ConnectionOption func(*ConnectionOptions)

func WithURI

func WithURI(uri string) ConnectionOption

type ConnectionOptions

type ConnectionOptions struct {
	URI      string          `json:"uri"`
	Scheme   string          `json:"scheme"`
	Username string          `json:"username"`
	Password string          `json:"password"`
	Port     int             `json:"port"`
	Host     string          `json:"host"`
	Vhost    string          `json:"vhost"`
	Config   *amqp091.Config `json:"config"`
}

func NewConnectionOptions

func NewConnectionOptions(opts ...ConnectionOption) (*ConnectionOptions, error)

type ConsumerOption

type ConsumerOption func(*ConsumerOptions)

func WithConsumerOptionConcurrency

func WithConsumerOptionConcurrency(concurrency int) ConsumerOption

WithConsumerOptionConcurrency sets concurrency

func WithConsumerOptionConsumerArgs

func WithConsumerOptionConsumerArgs(args map[string]interface{}) ConsumerOption

WithConsumerOptionConsumerArgs sets ConsumerArgs

func WithConsumerOptionConsumerAutoAck

func WithConsumerOptionConsumerAutoAck(autoAck bool) ConsumerOption

WithConsumerOptionConsumerAutoAck sets ConsumerAutoAck

func WithConsumerOptionConsumerExclusive

func WithConsumerOptionConsumerExclusive(exclusive bool) ConsumerOption

WithConsumerOptionConsumerExclusive sets ConsumerExclusive

func WithConsumerOptionConsumerName

func WithConsumerOptionConsumerName(consumerName string) ConsumerOption

WithConsumerOptionConsumerName sets ConsumerName

func WithConsumerOptionConsumerNoLocal

func WithConsumerOptionConsumerNoLocal(noLocal bool) ConsumerOption

WithConsumerOptionConsumerNoLocal sets ConsumerNoLocal

func WithConsumerOptionConsumerNoWait

func WithConsumerOptionConsumerNoWait(noWait bool) ConsumerOption

WithConsumerOptionConsumerNoWait sets ConsumerNoWait

func WithConsumerOptionConsumerQueue

func WithConsumerOptionConsumerQueue(queue string) ConsumerOption

WithConsumerOptionConsumerQueue sets ConsumerQueue

func WithConsumerOptionQOSGlobal

func WithConsumerOptionQOSGlobal(global bool) ConsumerOption

WithConsumerOptionQOSGlobal sets QOSGlobal

func WithConsumerOptionQOSPrefetch

func WithConsumerOptionQOSPrefetch(prefetchCount int) ConsumerOption

WithConsumerOptionQOSPrefetch sets QOSPrefetchCount

func WithConsumerOptionQOSPrefetchSize

func WithConsumerOptionQOSPrefetchSize(prefetchSize int) ConsumerOption

WithConsumerOptionQOSPrefetchSize sets QOSPrefetchSize

type ConsumerOptions

type ConsumerOptions struct {
	Concurrency int

	QOSPrefetchCount int
	QOSPrefetchSize  int
	QOSGlobal        bool

	ConsumerName      string
	ConsumerAutoAck   bool
	ConsumerExclusive bool
	ConsumerNoWait    bool
	ConsumerNoLocal   bool
	ConsumerArgs      map[string]interface{}
	ConsumerQueue     string
}

func NewConsumerOptions

func NewConsumerOptions(opts ...ConsumerOption) *ConsumerOptions

type ExchangeOptions

type ExchangeOptions struct {
	Name       string                 `yaml:"name"`
	Kind       string                 `yaml:"kind"`
	Durable    bool                   `yaml:"durable"`
	AutoDelete bool                   `yaml:"auto-delete"`
	Internal   bool                   `yaml:"internal"`
	NoWait     bool                   `yaml:"no-wait"`
	Args       map[string]interface{} `yaml:"args"`
}

type PublishOption

type PublishOption func(*PublishOptions)

PublishOption defines the option for publishing

func WithPublishOptionAppID

func WithPublishOptionAppID(appID string) PublishOption

WithPublishOptionAppID sets the app id option

func WithPublishOptionContentEncoding

func WithPublishOptionContentEncoding(contentEncoding string) PublishOption

WithPublishOptionContentEncoding sets the content type option

func WithPublishOptionContentType

func WithPublishOptionContentType(contentType string) PublishOption

WithPublishOptionContentType sets the content type option

func WithPublishOptionCorrelationID

func WithPublishOptionCorrelationID(correlationID string) PublishOption

WithPublishOptionCorrelationID sets the correlation id option

func WithPublishOptionDeliveryMode

func WithPublishOptionDeliveryMode(deliveryMode uint8) PublishOption

WithPublishOptionDeliveryMode sets the delivery mode option

func WithPublishOptionExpiration

func WithPublishOptionExpiration(expiration string) PublishOption

WithPublishOptionExpiration sets the expiration option

func WithPublishOptionHeaders

func WithPublishOptionHeaders(headers amqp091.Table) PublishOption

WithPublishOptionHeaders sets the headers option

func WithPublishOptionImmediate

func WithPublishOptionImmediate(immediate bool) PublishOption

WithPublishOptionImmediate sets the immediate option

func WithPublishOptionMandatory

func WithPublishOptionMandatory(mandatory bool) PublishOption

WithPublishOptionMandatory sets the mandatory option

func WithPublishOptionMaxRetry

func WithPublishOptionMaxRetry(MaxRetry uint64) PublishOption

WithPublishOptionMaxRetry sets the max retry option

func WithPublishOptionMessageID

func WithPublishOptionMessageID(messageID string) PublishOption

WithPublishOptionMessageID sets the message id option

func WithPublishOptionMsgExchange

func WithPublishOptionMsgExchange(msgExchange string) PublishOption

WithPublishOptionMsgExchange sets the msg exchange option

func WithPublishOptionMsgRoutingKey

func WithPublishOptionMsgRoutingKey(msgRoutingKey string) PublishOption

WithPublishOptionMsgRoutingKey sets the msg routing key option

func WithPublishOptionPriority

func WithPublishOptionPriority(priority uint8) PublishOption

WithPublishOptionPriority sets the priority option

func WithPublishOptionReplyTo

func WithPublishOptionReplyTo(replyTo string) PublishOption

WithPublishOptionReplyTo sets the reply to option

func WithPublishOptionTimestamp

func WithPublishOptionTimestamp(timestamp time.Time) PublishOption

WithPublishOptionTimestamp sets the timestamp option

func WithPublishOptionType

func WithPublishOptionType(typ string) PublishOption

WithPublishOptionType sets the type option

func WithPublishOptionUserID

func WithPublishOptionUserID(userID string) PublishOption

WithPublishOptionUserID sets the user id option

type PublishOptions

type PublishOptions struct {
	amqp091.Publishing

	// Mandatory fails to publish if there are no queues bound to the routing key
	// if msg is not important, set mandatory to false, can improve system throughput
	Mandatory bool
	// Immediate fails to publish if there are no consumers  that can ack bound to the queue on the routing key
	// if msg is not important, set mandatory to false, can improve system throughput
	Immediate bool

	MsgExchange   string // if set, will override the exchange in producer
	MsgRoutingKey string // if set, will override the routing key in producer
	MaxRetry      uint64 // max retry times, default 0
}

PublishOptions defines the options for publishing

func NewPublishOption

func NewPublishOption(opts ...PublishOption) *PublishOptions

NewPublishOption returns a new PublishOptions

type QueueOptions

type QueueOptions struct {
	Name       string                 `yaml:"name"`
	Durable    bool                   `yaml:"durable"`
	AutoDelete bool                   `yaml:"auto-delete"`
	Exclusive  bool                   `yaml:"exclusive"`
	NoWait     bool                   `yaml:"no-wait"`
	Args       map[string]interface{} `yaml:"args"`
}

Jump to

Keyboard shortcuts

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