Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Exchange ¶
type Exchange struct { // Name is the exchange name. Name string // Type is the exchange type. See ExchangeType for details. Type ExchangeType // IsDurable defines if is a durable queue. IsDurable bool // IsAutoDeleted defines if exchange is auto deleted. IsAutoDeleted bool // IsInternal defines if is a internal exchange. IsInternal bool // NoWait defines if is a noWait queue. NoWait bool // Args exchange creation args. Args map[string]interface{} // RoutingKey is the routingKey used to bind exchange to consumer queue (for topic exchanges). RoutingKey string }
Exchange contains exchange settings.
type ExchangeType ¶
type ExchangeType uint8
ExchangeType represents the RabbitMQ exchange type.
const ( /* ExchangeTypeDirect represents a direct exchange type. This exchange type is the default and will forward package directly to a queue which is the same as the given routing key. */ ExchangeTypeDirect ExchangeType = iota /* ExchangeTypeFanout represents a fanout exchange type. When a message is published to a fanout exchange the message will be forwarded to all binded queues. */ ExchangeTypeFanout /* ExchangeTypeTopic represents a topic exchange type. When a message is published to this type of exchange the message will only be forwarded to binded queues that matches to the publishing routingKey. */ ExchangeTypeTopic /* ExchangeTypeHeaders represents a header exchange type. When a message is published to this type of exchange the message will only be forwarded to binded queues that matches to publishing headers. */ ExchangeTypeHeaders )
func (ExchangeType) String ¶
func (t ExchangeType) String() string
String returns the ExchangeType as string:
ExchangeTypeDirect => "direct" ExchangeTypeFanout => "fanout" ExchangeTypeTopic => "topic" ExchangeTypeHeaders => "headers"
func (ExchangeType) Value ¶
func (t ExchangeType) Value() ExchangeType
Value check if exchange is valid, and if valid returns the current value otherwise returns 'direct' exchange as default
type Option ¶
type Option func(s Subscriber)
Option is a subscriber option used to customize the consumer.
func WithDurableFanoutExchange ¶
WithDurableFanoutExchange declare a fanout exchange an bind it to the consumer queue.
func WithDurablePriorityQueue ¶
WithDurablePriorityQueue defines a named durable queue for consumer with priority.
func WithDurableQueue ¶
WithDurableQueue defines a named durable queue for consumer.
func WithDurableTopicExchange ¶
WithDurableTopicExchange declare a topic exchange and bind it to the consumer queue.
type PrefetchQos ¶
type Queue ¶
type Subscriber ¶
type Subscriber interface { pubsub.Subscriber AddExchange(exchange *Exchange) SetQueue(queue *Queue) SetName(name string) SetPrefetchQos(qos *PrefetchQos) }
func NewSubscriber ¶
func NewSubscriber(uri string, options ...Option) Subscriber
NewSubscriber creates a new RabbitMQ consumer.