Documentation ¶
Overview ¶
Package rabbitmq is an AMQP 0.9.1 client with RabbitMQ extensions in Go.
Example ¶
package main import ( "github.com/boxgo/box/pkg/client/rabbitmq" "github.com/boxgo/box/pkg/logger" ) func main() { ch, err := rabbitmq.StdConfig("default").Build().Channel() if err != nil { logger.Panic(err) } q, err := ch.QueueDeclare("queue-name", true, true, false, false, nil) if err != nil { logger.Panic(err, q) } err = ch.Publish("", "queue-name", false, false, rabbitmq.Publishing{ DeliveryMode: rabbitmq.Persistent, ContentType: "text/plain", Body: []byte("hello world"), }) if err != nil { logger.Panic(err) } }
Output:
Index ¶
Examples ¶
Constants ¶
View Source
const ( ContentTooLarge = amqp.ContentTooLarge NoRoute = amqp.NoRoute NoConsumers = amqp.NoConsumers ConnectionForced = amqp.ConnectionForced InvalidPath = amqp.InvalidPath AccessRefused = amqp.AccessRefused NotFound = amqp.NotFound ResourceLocked = amqp.ResourceLocked PreconditionFailed = amqp.PreconditionFailed FrameError = amqp.FrameError SyntaxError = amqp.SyntaxError CommandInvalid = amqp.CommandInvalid ChannelError = amqp.ChannelError UnexpectedFrame = amqp.UnexpectedFrame ResourceError = amqp.ResourceError NotAllowed = amqp.NotAllowed NotImplemented = amqp.NotImplemented InternalError = amqp.InternalError )
View Source
const ( ExchangeDirect = amqp.ExchangeDirect ExchangeFanout = amqp.ExchangeFanout ExchangeTopic = amqp.ExchangeTopic ExchangeHeaders = amqp.ExchangeHeaders )
View Source
const ( Transient = amqp.Transient Persistent = amqp.Persistent )
Variables ¶
View Source
var ( // ErrClosed is returned when the channel or connection is not open ErrClosed = amqp.ErrClosed // ErrChannelMax is returned when Connection.Channel has been called enough // times that all channel IDs have been exhausted in the client or the // server. ErrChannelMax = amqp.ErrChannelMax // ErrSASL is returned from Dial when the authentication mechanism could not // be negoated. ErrSASL = amqp.ErrSASL // ErrCredentials is returned when the authenticated client is not authorized // to any vhost. ErrCredentials = amqp.ErrCredentials // ErrVhost is returned when the authenticated user is not permitted to // access the requested Vhost. ErrVhost = amqp.ErrVhost // ErrSyntax is hard protocol error, indicating an unsupported protocol, // implementation or encoding. ErrSyntax = amqp.ErrSyntax // ErrFrame is returned when the protocol frame cannot be read from the // server, indicating an unsupported protocol or unsupported frame type. ErrFrame = amqp.ErrFrame // ErrCommandInvalid is returned when the server sends an unexpected response // to this requested message type. This indicates a bug in this client. ErrCommandInvalid = amqp.ErrCommandInvalid // ErrUnexpectedFrame is returned when something other than a method or // heartbeat frame is delivered to the Connection, indicating a bug in the // client. ErrUnexpectedFrame = amqp.ErrUnexpectedFrame // ErrFieldType is returned when writing a message containing a Go type unsupported by AMQP. ErrFieldType = amqp.ErrFieldType )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { URI string `config:"uri" desc:"Connection uri"` Vhost string `` /* 161-byte string literal not displayed */ ChannelMax int `config:"channelMax" desc:"0 max channels means 2^16 - 1"` FrameSize int `config:"frameSize" desc:"0 max bytes means unlimited"` Heartbeat time.Duration `config:"heartbeat" desc:"less than 1s uses the server's interval"` // contains filtered or unexported fields }
Config 配置
type Publishing ¶
type Publishing = amqp.Publishing
Click to show internal directories.
Click to hide internal directories.