Documentation ¶
Overview ¶
Package rabbitmq provides a RabbitMQ broker
Index ¶
- Constants
- Variables
- func AckOnSuccess() broker.SubscribeOption
- func AppID(value string) broker.PublishOption
- func ConfirmPublish() broker.Option
- func ContentEncoding(value string) broker.PublishOption
- func ContentType(value string) broker.PublishOption
- func CorrelationID(value string) broker.PublishOption
- func DeliveryMode(value uint8) broker.PublishOption
- func DurableExchange() broker.Option
- func DurableQueue() broker.SubscribeOption
- func ExchangeName(e string) broker.Option
- func ExchangeType(t MQExchangeType) broker.Option
- func Expiration(value string) broker.PublishOption
- func ExternalAuth() broker.Option
- func Headers(h map[string]interface{}) broker.SubscribeOption
- func MessageId(value string) broker.PublishOption
- func NewBroker(opts ...broker.Option) broker.Broker
- func PrefetchCount(c int) broker.Option
- func PrefetchGlobal() broker.Option
- func Priority(value uint8) broker.PublishOption
- func PublishDeliveryMode(mode uint8) client.PublishOption
- func QueueArguments(h map[string]interface{}) broker.SubscribeOption
- func ReplyTo(value string) broker.PublishOption
- func RequeueOnError() broker.SubscribeOption
- func ServerAckOnSuccess() server.SubscriberOption
- func ServerDurableQueue() server.SubscriberOption
- func SubscribeContext(ctx context.Context) broker.SubscribeOption
- func Timestamp(value time.Time) broker.PublishOption
- func TypeMsg(value string) broker.PublishOption
- func UserID(value string) broker.PublishOption
- func WithoutExchange() broker.Option
- type Exchange
- type ExternalAuthentication
- type MQExchangeType
Constants ¶
const ( ExchangeTypeFanout MQExchangeType = "fanout" ExchangeTypeTopic = "topic" ExchangeTypeDirect = "direct" )
Variables ¶
var ( DefaultExchange = Exchange{ Name: "micro", Type: ExchangeTypeTopic, } DefaultRabbitURL = "amqp://guest:guest@127.0.0.1:5672" DefaultPrefetchCount = 0 DefaultPrefetchGlobal = false DefaultRequeueOnError = false DefaultConfirmPublish = false DefaultWithoutExchange = false )
Functions ¶
func AckOnSuccess ¶
func AckOnSuccess() broker.SubscribeOption
AckOnSuccess will automatically acknowledge messages when no error is returned.
func AppID ¶
func AppID(value string) broker.PublishOption
AppID sets a property application id for publishing.
func ConfirmPublish ¶ added in v1.1.1
ConfirmPublish ensures all published messages are confirmed by waiting for an ack/nack from the broker.
func ContentEncoding ¶
func ContentEncoding(value string) broker.PublishOption
ContentEncoding sets a property MIME content encoding for publishing.
func ContentType ¶
func ContentType(value string) broker.PublishOption
ContentType sets a property MIME content type for publishing.
func CorrelationID ¶
func CorrelationID(value string) broker.PublishOption
CorrelationID sets a property correlation ID for publishing.
func DeliveryMode ¶
func DeliveryMode(value uint8) broker.PublishOption
DeliveryMode sets a delivery mode for publishing.
func DurableExchange ¶
DurableExchange is an option to set the Exchange to be durable.
func DurableQueue ¶
func DurableQueue() broker.SubscribeOption
DurableQueue creates a durable queue when subscribing.
func ExchangeName ¶
ExchangeName is an option to set the ExchangeName.
func ExchangeType ¶ added in v1.2.1
func ExchangeType(t MQExchangeType) broker.Option
ExchangeType is an option to set the rabbitmq exchange type.
func Expiration ¶
func Expiration(value string) broker.PublishOption
Expiration sets a property message expiration spec for publishing.
func ExternalAuth ¶
func Headers ¶
func Headers(h map[string]interface{}) broker.SubscribeOption
Headers adds headers used by the headers exchange.
func MessageId ¶
func MessageId(value string) broker.PublishOption
MessageId sets a property message identifier for publishing.
func PrefetchGlobal ¶
PrefetchGlobal creates a durable queue when subscribing.
func Priority ¶
func Priority(value uint8) broker.PublishOption
Priority sets a priority level for publishing.
func PublishDeliveryMode ¶ added in v1.3.0
func PublishDeliveryMode(mode uint8) client.PublishOption
PublishDeliveryMode client.PublishOption for setting message "delivery mode" mode , Transient (0 or 1) or Persistent (2)
func QueueArguments ¶
func QueueArguments(h map[string]interface{}) broker.SubscribeOption
QueueArguments sets arguments for queue creation.
func ReplyTo ¶
func ReplyTo(value string) broker.PublishOption
ReplyTo sets a property address to to reply to (ex: RPC) for publishing.
func RequeueOnError ¶
func RequeueOnError() broker.SubscribeOption
func ServerAckOnSuccess ¶ added in v1.3.0
func ServerAckOnSuccess() server.SubscriberOption
ServerAckOnSuccess export AckOnSuccess server.SubscriberOption
func ServerDurableQueue ¶ added in v1.3.0
func ServerDurableQueue() server.SubscriberOption
ServerDurableQueue provide durable queue option for micro.RegisterSubscriber
func SubscribeContext ¶
func SubscribeContext(ctx context.Context) broker.SubscribeOption
SubscribeContext set the context for broker.SubscribeOption.
func Timestamp ¶
func Timestamp(value time.Time) broker.PublishOption
Timestamp sets a property message timestamp for publishing.
func TypeMsg ¶
func TypeMsg(value string) broker.PublishOption
TypeMsg sets a property message type name for publishing.
func UserID ¶
func UserID(value string) broker.PublishOption
UserID sets a property user id for publishing.
func WithoutExchange ¶ added in v1.2.1
WithoutExchange is an option to use the rabbitmq default exchange. means it would not create any custom exchange.
Types ¶
type Exchange ¶
type Exchange struct { // Name of the exchange Name string // Type of the exchange Type MQExchangeType // Whether its persistent Durable bool }
Exchange is the rabbitmq exchange.
type ExternalAuthentication ¶
type ExternalAuthentication struct { }
func (*ExternalAuthentication) Mechanism ¶
func (auth *ExternalAuthentication) Mechanism() string
func (*ExternalAuthentication) Response ¶
func (auth *ExternalAuthentication) Response() string
type MQExchangeType ¶ added in v1.2.1
type MQExchangeType string