Documentation
¶
Index ¶
- func NewDsn(host, port, vhost, user, pass string) string
- func NewExchange(name, etype string, opts ...*ecOption) *exchange
- func NewQueue(exchange, name string, routingKey []string, opts ...queOption) *queue
- func WithCsAutoAck(autoAck bool) *csOption
- func WithCsExclusive(exclusive bool) *csOption
- func WithCsNoLocal(noLocal bool) *csOption
- func WithCsNoWait(noWait bool) *csOption
- func WithCsQueueType(queueType string) *csOption
- func WithEcAutoDelete(autoDelete bool) *ecOption
- func WithEcDurable(durable bool) *ecOption
- func WithEcInternal(internal bool) *ecOption
- func WithEcNoWait(noWait bool) *ecOption
- func WithQueAutoDeleteOption(autoDelete bool) *queOption
- func WithQueDurable(durable bool) *queOption
- func WithQueExclusive(exclusive bool) *queOption
- func WithQueNowait(nowait bool) *queOption
- func WithRcHeartbeat(heartbeat time.Duration) *connOption
- func WithRcLogger(logger Logx) *connOption
- func WithRcQos(prefetchCount int) *connOption
- func WithRcTimeOut(timeout time.Duration) *connOption
- type ConnConfig
- type Connection
- type Consumer
- type ConsumerHandler
- type Logx
- type Producer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewExchange ¶
func NewExchange(name, etype string, opts ...*ecOption) *exchange
func WithCsAutoAck ¶
func WithCsAutoAck(autoAck bool) *csOption
func WithCsExclusive ¶
func WithCsExclusive(exclusive bool) *csOption
func WithCsNoLocal ¶
func WithCsNoLocal(noLocal bool) *csOption
func WithCsNoWait ¶
func WithCsNoWait(noWait bool) *csOption
func WithCsQueueType ¶
func WithCsQueueType(queueType string) *csOption
func WithEcAutoDelete ¶
func WithEcAutoDelete(autoDelete bool) *ecOption
func WithEcDurable ¶
func WithEcDurable(durable bool) *ecOption
func WithEcInternal ¶
func WithEcInternal(internal bool) *ecOption
func WithEcNoWait ¶
func WithEcNoWait(noWait bool) *ecOption
func WithQueAutoDeleteOption ¶
func WithQueAutoDeleteOption(autoDelete bool) *queOption
func WithQueDurable ¶
func WithQueDurable(durable bool) *queOption
func WithQueExclusive ¶
func WithQueExclusive(exclusive bool) *queOption
func WithQueNowait ¶
func WithQueNowait(nowait bool) *queOption
func WithRcHeartbeat ¶
func WithRcLogger ¶
func WithRcLogger(logger Logx) *connOption
func WithRcTimeOut ¶
Types ¶
type ConnConfig ¶
type ConnConfig struct { PrefetchCount int Heartbeat time.Duration // default: 20s TimeOut time.Duration // default: 30s Logger Logx }
func ConnCfgParse ¶
func ConnCfgParse(rcOpts ...*connOption) *ConnConfig
type Connection ¶
type Connection struct { DSN string // contains filtered or unexported fields }
func NewConnetion ¶
func NewConnetion(dsn string, exchange *exchange, connOpts ...*connOption) *Connection
func (*Connection) Close ¶
func (connection *Connection) Close() error
Close will cleanly shutdown the channel and connection.
type Consumer ¶
type Consumer struct { Workers int Queue *queue Option *consumerOption Conn *Connection }
func NewConsumer ¶
func NewConsumer(conn *Connection, que *queue, workers int, opts ...*csOption) *Consumer
func (*Consumer) Start ¶
func (consumer *Consumer) Start(handler ConsumerHandler)
StartConsumer will open specified consumers When queue is empty, the queue uses default configuration
type ConsumerHandler ¶
type ConsumerHandler func(d []byte)
type Producer ¶
type Producer struct { RoutingKey string Body []byte Conn *Connection }
func NewProducer ¶
func NewProducer(routingKey string, body []byte, conn *Connection) *Producer
func (*Producer) Push ¶
Push will push data onto the queue, and wait for a confirm. If no confirms are received until within the resendTimeout, it continuously re-sends messages until a confirm is received. This will block until the server sends a confirm. Errors are only returned if the push action itself fails, see UnsafePush.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.