Documentation ¶
Index ¶
- Constants
- type Channel
- func (c *Channel) Consume(name string) (<-chan amqp.Delivery, error)
- func (c *Channel) ExchangeDeclare(ex *Exchange) error
- func (c *Channel) Publish(data *PublishData) error
- func (c *Channel) QueueBind(queueName, key, exchangeName string, args amqp.Table) error
- func (c *Channel) QueueDeclare(queue *Queue) (amqp.Queue, error)
- type ChannelPool
- type ChannelService
- type ConnPoolOptions
- type Connection
- type ConnectionConfig
- type ConnectionPool
- type Consumer
- type ConsumerService
- type Exchange
- type Job
- type JobService
- type Message
- type Options
- type Producer
- type ProducerService
- type PublishData
- type Queue
- type Rabbit
- type RabbitService
Constants ¶
View Source
const ( DefaultConnNum = 1 DefaultChannelNum = 1 DefaultHost = "amqp://guest:guest@localhost:5672/" )
View Source
const RabbitAttempt = "rabbit_attempt"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
func NewChannel ¶
func (*Channel) ExchangeDeclare ¶
func (*Channel) Publish ¶
func (c *Channel) Publish(data *PublishData) error
type ChannelPool ¶
type ChannelPool struct {
// contains filtered or unexported fields
}
func NewChannelPool ¶
func NewChannelPool(pool *list.List) *ChannelPool
func (*ChannelPool) Get ¶
func (p *ChannelPool) Get() (*Channel, error)
func (*ChannelPool) Release ¶
func (p *ChannelPool) Release(channel *Channel)
type ChannelService ¶
type ChannelService interface {
Publish(data *PublishData) error
}
type ConnPoolOptions ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(config *ConnectionConfig) *Connection
func (*Connection) GetChannelPool ¶
func (c *Connection) GetChannelPool() *ChannelPool
type ConnectionConfig ¶
type ConnectionPool ¶
type ConnectionPool struct {
// contains filtered or unexported fields
}
func NewConnectionPool ¶
func NewConnectionPool(opts *ConnPoolOptions) *ConnectionPool
func (*ConnectionPool) Get ¶
func (c *ConnectionPool) Get() (*Connection, error)
func (*ConnectionPool) Release ¶
func (c *ConnectionPool) Release(conn *Connection)
type ConsumerService ¶
type ConsumerService struct { Rabbit RabbitService // contains filtered or unexported fields }
func NewConsumerService ¶
func NewConsumerService(rabbit RabbitService) *ConsumerService
func (*ConsumerService) Consume ¶
func (c *ConsumerService) Consume(name string) error
func (*ConsumerService) Listen ¶
func (c *ConsumerService) Listen(name string)
type Exchange ¶
type Exchange struct { Name string Kind string Durable bool AutoDelete bool Internal bool NoWait bool Args amqp.Table }
name, kind string, durable, autoDelete, internal, noWait bool, args Table
type Job ¶
type Job interface { RabbitService }
func NewJobService ¶
func NewJobService(m *Message, rabbitService RabbitService) Job
type JobService ¶
type JobService struct { RabbitService // contains filtered or unexported fields }
func (*JobService) Ack ¶
func (j *JobService) Ack() error
func (*JobService) Attempt ¶
func (j *JobService) Attempt() int
type Producer ¶
type Producer interface {
Publish(ctx context.Context, exchange *Exchange, message *Message) error
}
func NewProducerService ¶
func NewProducerService(rabbit RabbitService) Producer
type ProducerService ¶
type ProducerService struct {
Rabbit RabbitService
}
type PublishData ¶
type Queue ¶
type Queue struct { Name string Durable bool AutoDelete bool Exclusive bool NoWait bool Args amqp.Table }
name string, durable, autoDelete, exclusive, noWait bool, args Table
type Rabbit ¶
type Rabbit struct {
// contains filtered or unexported fields
}
func (*Rabbit) ExchangeDeclare ¶
declare exchange if not exist
func (*Rabbit) GetConnectionPool ¶
func (r *Rabbit) GetConnectionPool() *ConnectionPool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.