Documentation ¶
Index ¶
- Constants
- func DeadLetterArgs(ttl int, exchange, toQueue string) amqp.Table
- type Binding
- type Connection
- func (c *Connection) Close() error
- func (c *Connection) CreateScheme(s Settings) error
- func (c *Connection) DeleteScheme(s Settings) error
- func (c *Connection) ProcessQueue(name string, f func([]byte)) error
- func (c *Connection) SendBlob(ex, key string, msg []byte) error
- func (c *Connection) SendMessage(ex, key, msg string) error
- type Exchange
- type QueueSpec
- type Settings
Constants ¶
const ( MESSAGE_TTL = "x-message-ttl" DEAD_EXCHANGE = "x-dead-letter-exchange" DEAD_ROUTING_KEY = "x-dead-letter-routing-key" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Binding ¶
type Binding struct { Exchange string `yaml:"exchange"` Key string `yaml:"key"` Nowait bool `yaml:"nowait"` }
Binding specifies to which exchange should be an exchange or a queue binded
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection is a struct which holds all necessary data for RabbitMQ connection
func Connect ¶
func Connect(dsn string) (*Connection, error)
Connect connects to RabbitMQ by dsn and return Connection object which uses openned connection during function calls issued later in code
func (*Connection) CreateScheme ¶
func (c *Connection) CreateScheme(s Settings) error
CreateScheme creates all exchanges, queues and bindinges between them as specified in yaml string
func (*Connection) DeleteScheme ¶
func (c *Connection) DeleteScheme(s Settings) error
DeleteScheme deletes all queues and exchanges (together with bindings) as specified in yaml string
func (*Connection) ProcessQueue ¶
func (c *Connection) ProcessQueue(name string, f func([]byte)) error
ProcessQueue calls handler function on each message delivered to a queue
func (*Connection) SendBlob ¶
func (c *Connection) SendBlob(ex, key string, msg []byte) error
SendBlob publishes byte blob message to an exchange with specific routing key
func (*Connection) SendMessage ¶
func (c *Connection) SendMessage(ex, key, msg string) error
SendMessage publishes plain text message to an exchange with specific routing key
type Exchange ¶
type Exchange struct { Durable bool `yaml:"durable"` Autodelete bool `yaml:"autodelete"` Internal bool `yaml:"internal"` Nowait bool `yaml:"nowait"` Type string `yaml:"type"` Bindings []Binding `yaml:"bindings"` }
Exchange is structure with specification of properties of RabbitMQ exchange
type QueueSpec ¶
type QueueSpec struct { Durable bool `yaml:"durable"` Autodelete bool `yaml:"autodelete"` Nowait bool `yaml:"nowait"` Exclusive bool `yaml:"exclusive"` Bindings []Binding `yaml:"bindings"` Args amqp.Table `yaml:"args"` }
QueueSpec is a specification of properties of RabbitMQ queue