Documentation
¶
Index ¶
- Constants
- Variables
- type Callback
- type ConsumerSetting
- type Hedwig
- func (h *Hedwig) AddQueue(qSetting *QueueSetting, qName string) error
- func (h *Hedwig) Consume() error
- func (h *Hedwig) DelayedPublishWithContext(ctx context.Context, key string, body []byte, delay time.Duration) (err error)
- func (h *Hedwig) Disconnect() error
- func (h *Hedwig) DoPublish(ctx context.Context, exchange, channel, key string, body []byte, ...) error
- func (h *Hedwig) Publish(key string, body []byte) (err error)
- func (h *Hedwig) PublishWithContext(ctx context.Context, key string, body []byte) (err error)
- func (h *Hedwig) PublishWithDelay(key string, body []byte, delay time.Duration) (err error)
- func (h *Hedwig) PublishWithHeaders(key string, body []byte, headers map[string]interface{}) (err error)
- type QueueSetting
- type Settings
Constants ¶
View Source
const ( PublishChannel = "publish" DelayedPublishChannel = "publish_delay" SubscribeChannel = "subscribe" )
View Source
const ( // For exchanges which use RMQ delay plugin, following type should be used as ExchangeType ExchangeTypeDelayed = "x-delayed-message" // Delayed Type Exchanges also need an extra arg with following key with the value set to actual ExchangeType // like `direct`, `topic` etc DelayedExchangeArgKey = "x-delayed-type" // Following header should be used when you are publishing to an Delay exchange. The header value will be // delay in milliseconds DelayHeader = "x-delay" MessageTTLArgKey = "x-message-ttl" )
Variables ¶
View Source
var ( ErrNilHedwig = errors.New("hedwig is nil, use `New` to create an instance") ErrAlreadyInitialized = errors.New("already initialized, disconnect before attempting again") ErrNoBindings = errors.New("no bindings provided, need at least one") ErrNoConsumerSetting = errors.New("consumer setting is nil") )
Functions ¶
This section is empty.
Types ¶
type ConsumerSetting ¶
type ConsumerSetting struct {
Queues map[string]*QueueSetting
// contains filtered or unexported fields
}
type Hedwig ¶
type Hedwig struct {
sync.Mutex
Settings *Settings
DelayedSettings *Settings
Error error
// contains filtered or unexported fields
}
func (*Hedwig) DelayedPublishWithContext ¶
func (*Hedwig) Disconnect ¶
Both hedwig exchange and delayed exchange will use the same broker hence no need to update here. The same connection object can be used.
func (*Hedwig) PublishWithContext ¶
func (*Hedwig) PublishWithDelay ¶
Deprecated, use DelayedPublishWithContext
type QueueSetting ¶
type QueueSetting struct {
Bindings []string
Callback Callback
Durable bool
AutoDelete bool
Exclusive bool
NoAck bool
QueueArgs amqp.Table
}
func DefaultQueueSetting ¶
func DefaultQueueSetting(callback Callback, bindings ...string) *QueueSetting
type Settings ¶
type Settings struct {
Exchange string
ExchangeType string
ExchangeArgs amqp.Table
HeartBeatInterval time.Duration
SocketTimeout time.Duration
Host string
Port int
Vhost string
Username string
Password string
Consumer *ConsumerSetting
}
func DefaultDelayedSettings ¶
func DefaultDelayedSettings() *Settings
func DefaultSettings ¶
func DefaultSettings() *Settings
Click to show internal directories.
Click to hide internal directories.