Documentation ¶
Index ¶
- func SetLogger(log ILogger)
- func ShowDefaultLogger(on bool)
- type AMQPManager
- func (m *AMQPManager) AutoRelink(ctx context.Context)
- func (m *AMQPManager) Consumers() map[string]IConsumer
- func (m *AMQPManager) Declare(channel *amqpMeta.Channel, declareFunc ...DeclareFunc) error
- func (m *AMQPManager) DisConnect() error
- func (m *AMQPManager) GetConnect() (*amqpMeta.Connection, error)
- func (m *AMQPManager) GetConsumer(name string) IConsumer
- func (m *AMQPManager) GetProducer(name string) IProducer
- func (m *AMQPManager) NewChannel() (*amqpMeta.Channel, error)
- func (m *AMQPManager) NoRelink()
- func (m *AMQPManager) Producers() map[string]IProducer
- func (m *AMQPManager) PublishOnce(ctx context.Context, exchange, router string, encoder Encoder, ...) ([]error, error)
- func (m *AMQPManager) Register(c ICaller) error
- func (m *AMQPManager) URL() string
- type CloseHandler
- type ConfirmHandler
- type Consumer
- type DeclareFunc
- type DeliveryHandler
- type Element
- type Encoder
- type Exchange
- type ExchangeType
- type ICaller
- type IConsumer
- type ILogger
- type IMessage
- type IProducer
- type JSONEncoder
- type Producer
- type Queue
- type ReturnHandler
- type Router
- type TCPSection
- func (m *TCPSection) GetHost() string
- func (m *TCPSection) GetPath() string
- func (m *TCPSection) GetPort() int32
- func (m *TCPSection) GetPwd() string
- func (m *TCPSection) GetUser() string
- func (m *TCPSection) SetHost(v string)
- func (m *TCPSection) SetPath(v string)
- func (m *TCPSection) SetPort(v int32)
- func (m *TCPSection) SetPwd(v string)
- func (m *TCPSection) SetUser(v string)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShowDefaultLogger ¶
func ShowDefaultLogger(on bool)
Types ¶
type AMQPManager ¶
type AMQPManager struct { TCPSection // contains filtered or unexported fields }
AMQPManager mq manager
func NewManager ¶
func NewManager(host, user, pwd, path string, port int32) *AMQPManager
func (*AMQPManager) AutoRelink ¶
func (m *AMQPManager) AutoRelink(ctx context.Context)
AutoRelink auto relink consumer/producer in manager
func (*AMQPManager) Consumers ¶
func (m *AMQPManager) Consumers() map[string]IConsumer
func (*AMQPManager) Declare ¶
func (m *AMQPManager) Declare(channel *amqpMeta.Channel, declareFunc ...DeclareFunc) error
Declare declare some element, such as exchange/queue/router
func (*AMQPManager) DisConnect ¶
func (m *AMQPManager) DisConnect() error
DisConnect close connection
func (*AMQPManager) GetConnect ¶
func (m *AMQPManager) GetConnect() (*amqpMeta.Connection, error)
GetConnect get open connection
func (*AMQPManager) GetConsumer ¶
func (m *AMQPManager) GetConsumer(name string) IConsumer
func (*AMQPManager) GetProducer ¶
func (m *AMQPManager) GetProducer(name string) IProducer
func (*AMQPManager) NewChannel ¶
func (m *AMQPManager) NewChannel() (*amqpMeta.Channel, error)
NewChannel get new channel in a living connect
func (*AMQPManager) NoRelink ¶
func (m *AMQPManager) NoRelink()
func (*AMQPManager) Producers ¶
func (m *AMQPManager) Producers() map[string]IProducer
func (*AMQPManager) PublishOnce ¶
func (m *AMQPManager) PublishOnce(ctx context.Context, exchange, router string, encoder Encoder, messages ...IMessage) ([]error, error)
PublishOnce publish message in new connect
func (*AMQPManager) Register ¶
func (m *AMQPManager) Register(c ICaller) error
Register register consumer/producer in manager
func (*AMQPManager) URL ¶
func (m *AMQPManager) URL() string
URL build url string
Example ¶
m := &AMQPManager{ TCPSection: TCPSection{ host: "localhost", port: 5672, user: "test", pwd: "123456", path: "/test", }, } println(m.URL())
Output:
type CloseHandler ¶
type ConfirmHandler ¶
type ConfirmHandler func(c amqpMeta.Confirmation)
type Consumer ¶
type Consumer struct { Name string Ctx context.Context QueueName string NoLocal bool AutoAck bool Exclusive bool NoWait bool Arguments map[string]interface{} CloseHandlers []CloseHandler DeliveryHandlers []DeliveryHandler // contains filtered or unexported fields }
func (*Consumer) AddCloseHandler ¶
func (e *Consumer) AddCloseHandler(h CloseHandler)
func (*Consumer) AddDeliveryHandler ¶
func (e *Consumer) AddDeliveryHandler(h DeliveryHandler)
func (*Consumer) Link ¶
func (e *Consumer) Link(m *AMQPManager) error
type DeclareFunc ¶
func WithExchange ¶
func WithExchange(e Exchange) DeclareFunc
func WithQueue ¶
func WithQueue(e Queue) DeclareFunc
func WithRouter ¶
func WithRouter(e Router) DeclareFunc
type DeliveryHandler ¶
type Exchange ¶
type Exchange struct { Element Kind ExchangeType Internal bool }
type ExchangeType ¶
type ExchangeType int32
const ( Nil ExchangeType = iota Direct Topic FanOut Headers )
func (ExchangeType) String ¶
func (i ExchangeType) String() string
type ICaller ¶
type ICaller interface { Identify() string Link(m *AMQPManager) error }
type IConsumer ¶
type IConsumer interface { ICaller AddCloseHandler(h CloseHandler) AddDeliveryHandler(h DeliveryHandler) }
type ILogger ¶
type IProducer ¶
type IProducer interface { ICaller Publish(ctx context.Context, router string, encoder Encoder, messages ...IMessage) ([]error, error) }
func NewProducer ¶
type JSONEncoder ¶
type JSONEncoder struct{}
func (JSONEncoder) Decode ¶
func (e JSONEncoder) Decode(data []byte, v interface{}) error
func (JSONEncoder) Encode ¶
func (e JSONEncoder) Encode(v interface{}) ([]byte, error)
func (JSONEncoder) GetContentType ¶
func (e JSONEncoder) GetContentType() string
func (JSONEncoder) GetEncoding ¶
func (e JSONEncoder) GetEncoding() string
type ReturnHandler ¶
type Router ¶
type TCPSection ¶
type TCPSection struct {
// contains filtered or unexported fields
}
func (*TCPSection) GetHost ¶
func (m *TCPSection) GetHost() string
func (*TCPSection) GetPath ¶
func (m *TCPSection) GetPath() string
func (*TCPSection) GetPort ¶
func (m *TCPSection) GetPort() int32
func (*TCPSection) GetPwd ¶
func (m *TCPSection) GetPwd() string
func (*TCPSection) GetUser ¶
func (m *TCPSection) GetUser() string
func (*TCPSection) SetHost ¶
func (m *TCPSection) SetHost(v string)
func (*TCPSection) SetPath ¶
func (m *TCPSection) SetPath(v string)
func (*TCPSection) SetPort ¶
func (m *TCPSection) SetPort(v int32)
func (*TCPSection) SetPwd ¶
func (m *TCPSection) SetPwd(v string)
func (*TCPSection) SetUser ¶
func (m *TCPSection) SetUser(v string)
Click to show internal directories.
Click to hide internal directories.