Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) Close()
- func (c *Client) ParseDefiniteMessage(msg amqp.Delivery) (dm DefiniteMessage, ok bool)
- func (c *Client) Publish(exchange, routeKey string, opts ...PublishOption) (err error)
- func (c *Client) PublishDefinite(exchange, routeKey string, opts ...PublishOption) (err error)
- func (c *Client) SetConsumer(consumer func(c *Client, msg amqp.Delivery))
- type Config
- type DefiniteMessage
- type ExchangeOption
- type Option
- func AmqpConfig(config amqp.Config) Option
- func Auth(username, password string) Option
- func Confirm(chSize int, timeout time.Duration, noWait bool) Option
- func ConsumeInOrder() Option
- func Consumer(consumer func(c *Client, msg amqp.Delivery)) Option
- func ConsumerTag(consumerTag string) Option
- func Debug() Option
- func DefaultConsumer() Option
- func Exchange(name string, kind kind, opts ...ExchangeOption) Option
- func Heartbeat(ht time.Duration) Option
- func PrefetchCount(count int) Option
- func QosGlobal(global bool) Option
- func QosPrefetchCount(count int) Option
- func QosPrefetchSize(size int) Option
- func Queue(name, routeKey string, opts ...QueueOption) Option
- func QueueDisable() Option
- func Recovery(retryInterval time.Duration) Option
- func Tls(tls *tls.Config) Option
- func TlsCert(caFile, certFile, keyFile, keyFilePassword string) Option
- func VHost(vh string) Option
- type PublishOption
- func PublishAppId(appId string) PublishOption
- func PublishBody(body []byte) PublishOption
- func PublishContentEncoding(contentEncoding string) PublishOption
- func PublishContentType(contentType string) PublishOption
- func PublishCorrelationId(correlationId string) PublishOption
- func PublishDeliveryMode(deliveryMode uint8) PublishOption
- func PublishExpiration(expire string) PublishOption
- func PublishHeaders(keyPairs ...interface{}) PublishOption
- func PublishMessageId(messageId string) PublishOption
- func PublishPriority(priority uint8) PublishOption
- func PublishReplyTo(replyTo string) PublishOption
- func PublishTimestamp(timestamp time.Time) PublishOption
- func PublishType(typ string) PublishOption
- func PublishUserId(userId string) PublishOption
- type Qos
- type QueueOption
Constants ¶
const ( KindDirect kind = amqp.ExchangeDirect KindFanout kind = amqp.ExchangeFanout KindHeaders kind = amqp.ExchangeHeaders KindTopic kind = amqp.ExchangeTopic )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ParseDefiniteMessage ¶
func (c *Client) ParseDefiniteMessage(msg amqp.Delivery) (dm DefiniteMessage, ok bool)
func (*Client) Publish ¶
func (c *Client) Publish(exchange, routeKey string, opts ...PublishOption) (err error)
Publish send message
func (*Client) PublishDefinite ¶
func (c *Client) PublishDefinite(exchange, routeKey string, opts ...PublishOption) (err error)
PublishDefinite send definite message
type Config ¶
type Config struct { Addr string Username string Password string //deprecated PrefetchCount int Qos Qos Exchanges []*exchange Queue *queue QueueDisable bool Confirm confirm Consumer func(c *Client, msg amqp.Delivery) ConsumerTag string // if ConsumeInOrder set to true,consumer will process message in order,not use goroutine ConsumeInOrder bool Recovery recovery Amqp amqp.Config // contains filtered or unexported fields }
type DefiniteMessage ¶
type ExchangeOption ¶
type ExchangeOption func(ex *exchange)
func ExchangeArgs ¶
func ExchangeArgs(args amqp.Table) ExchangeOption
func ExchangeAutoDelete ¶
func ExchangeAutoDelete() ExchangeOption
func ExchangeDurable ¶
func ExchangeDurable() ExchangeOption
func ExchangeInternal ¶
func ExchangeInternal() ExchangeOption
func ExchangeNoWait ¶
func ExchangeNoWait() ExchangeOption
type Option ¶
type Option func(cfg *Config)
func AmqpConfig ¶
func Exchange ¶
func Exchange(name string, kind kind, opts ...ExchangeOption) Option
Exchange add exchange,support multiple
func QosPrefetchCount ¶ added in v1.0.4
func QosPrefetchSize ¶ added in v1.0.4
func Queue ¶
func Queue(name, routeKey string, opts ...QueueOption) Option
Queue set queue properties
type PublishOption ¶
type PublishOption func(pub *amqp.Publishing)
func PublishAppId ¶
func PublishAppId(appId string) PublishOption
PublishAppId creating application id
func PublishBody ¶
func PublishBody(body []byte) PublishOption
PublishBody The application specific payload of the message
func PublishContentEncoding ¶
func PublishContentEncoding(contentEncoding string) PublishOption
PublishContentEncoding MIME content encoding
func PublishContentType ¶
func PublishContentType(contentType string) PublishOption
PublishContentType MIME content type
func PublishCorrelationId ¶
func PublishCorrelationId(correlationId string) PublishOption
PublishCorrelationId correlation identifier
func PublishDeliveryMode ¶
func PublishDeliveryMode(deliveryMode uint8) PublishOption
PublishDeliveryMode Transient (0 or 1) or Persistent (2)
func PublishExpiration ¶
func PublishExpiration(expire string) PublishOption
PublishExpiration Expiration // message expiration spec
func PublishHeaders ¶
func PublishHeaders(keyPairs ...interface{}) PublishOption
PublishHeaders Application or exchange specific fields, the headers exchange will inspect this field.
func PublishMessageId ¶
func PublishMessageId(messageId string) PublishOption
PublishMessageId message identifier
func PublishReplyTo ¶
func PublishReplyTo(replyTo string) PublishOption
PublishReplyTo address to to reply to (ex: RPC)
func PublishTimestamp ¶
func PublishTimestamp(timestamp time.Time) PublishOption
PublishTimestamp message timestamp
func PublishUserId ¶
func PublishUserId(userId string) PublishOption
PublishUserId creating user id - ex: "guest"
type QueueOption ¶
type QueueOption func(queue *queue)
func QueueArgs ¶
func QueueArgs(args amqp.Table) QueueOption
func QueueAutoDelete ¶
func QueueAutoDelete() QueueOption
func QueueConsumeAutoAck ¶
func QueueConsumeAutoAck() QueueOption
func QueueDurable ¶
func QueueDurable() QueueOption
func QueueExclusive ¶
func QueueExclusive() QueueOption
func QueueNoWait ¶
func QueueNoWait() QueueOption