Documentation ¶
Overview ¶
This is queue library wrapper for widely popular queues. AnyQ provide one way to handle various queues.
Supporting Queues
- RabbitMQ(https://www.rabbitmq.com)
- Kafka(https://kafka.apache.org)
- NSQ(http://nsq.io)
- NATS(http://nats.io)
Index ¶
- func Register(name string, queue Queuer)
- type Consumer
- type Kafka
- type KafkaConsumerArgs
- type KafkaProducerArgs
- type LogLevel
- type Message
- type Nats
- type NatsConsumerArgs
- type NatsProducerArgs
- type Nsq
- type NsqConsumerArgs
- type NsqProducerArgs
- type Producer
- type Queuer
- type Rabbitmq
- func (q *Rabbitmq) Close() error
- func (q *Rabbitmq) Conn() (interface{}, error)
- func (q *Rabbitmq) NewConsumer(v interface{}) (Consumer, error)
- func (q *Rabbitmq) NewProducer(v interface{}) (Producer, error)
- func (q *Rabbitmq) SetLogger(l logger, level LogLevel)
- func (q *Rabbitmq) Setup(url string) error
- type RabbitmqConsumerArgs
- type RabbitmqProducerArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Consumer ¶
type Consumer interface { // Consumer returns original consumer object Consumer() (interface{}, error) // BindRecvChan bind a channel for receive operations from queue. BindRecvChan(messages chan<- *Message) error // contains filtered or unexported methods }
Consumer process messages from Queue.
type Kafka ¶
type Kafka struct { Brokers []string // The comma separated list of brokers in the Kafka cluster Zookeepers []string // contains filtered or unexported fields }
func (*Kafka) NewConsumer ¶
func (*Kafka) NewProducer ¶
type KafkaConsumerArgs ¶
type KafkaProducerArgs ¶
type Nats ¶
type Nats struct {
// contains filtered or unexported fields
}
func (*Nats) NewConsumer ¶
func (*Nats) NewProducer ¶
type NatsConsumerArgs ¶
type NatsConsumerArgs struct {
Subject string
}
type NatsProducerArgs ¶
type NatsProducerArgs struct {
Subject string
}
type Nsq ¶
type Nsq struct {
// contains filtered or unexported fields
}
func (*Nsq) NewConsumer ¶
func (*Nsq) NewProducer ¶
type NsqConsumerArgs ¶
type NsqConsumerArgs struct {
Topic, Channel string
}
type NsqProducerArgs ¶
type NsqProducerArgs struct {
Topic string
}
type Producer ¶
type Producer interface { // Producer returns original producer object Producer() (interface{}, error) // Producer bind a channel for send operations to queue. BindSendChan(messages <-chan []byte) error // contains filtered or unexported methods }
Producer publish messages to Queue.
type Queuer ¶
type Queuer interface { // Conn returns original connection object. Conn() (interface{}, error) // NewConsumer create new consumer. // You MUST pass valid argument such as RabbitmqConsumerArgs, KafkaConsumerArgs, NsqConsumerArgs, and NatsConsumerArgs NewConsumer(args interface{}) (Consumer, error) // NewProducer create new producer. // You MUST pass valid argument such as RabbitmqProducerArgs, KafkaProducerArgs, NsqProducerArgs, and NatsProducerArgs NewProducer(args interface{}) (Producer, error) // SetLogger assigns the logger to use as well as a level. // The logger parameter is an interface that requires the following method to be implemented (such as the the stdlib log.Logger): // // Output(calldepth int, s string) // SetLogger(logger, LogLevel) Setup(string) error // contains filtered or unexported methods }
Queuer provide generic method to handle queue
type RabbitmqConsumerArgs ¶
Click to show internal directories.
Click to hide internal directories.