Documentation
¶
Index ¶
- func Close()
- func Initialize(ctx context.Context)
- func Publish(in Job, cnt string) error
- func RegisterConsumer(consumer Consumer, cnt string) error
- func RegisterRabbit(cnt, host, user, password, vHost string, port int)
- func RegisterRabbitMq(name, host string, port int, user, password, vhost string)
- type Channel
- type Connection
- type Consumer
- type Delivery
- type Job
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Initialize ¶
func RegisterConsumer ¶
func RegisterRabbit ¶
func RegisterRabbitMq ¶
RegisterRabbitMq is an alias for RegisterRabbit
Types ¶
type Channel ¶
type Channel interface {
Confirm(noWait bool) error
NotifyPublish(confirm chan amqp.Confirmation) chan amqp.Confirmation
Publish(exchange, key string, mandatory, immediate bool, msg amqp.Publishing) error
Close() error
}
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection wraps RabbitMQ operations
func GetConnection ¶
func GetConnection(name string) (*Connection, error)
GetConnection returns RabbitMQ connection wrapper
func (*Connection) PublishJSON ¶
func (c *Connection) PublishJSON(ctx context.Context, queue string, data interface{}) error
PublishJSON publishes JSON message
type Consumer ¶
type Consumer interface {
// Topic return the topic that this worker want to listen to it
Topic() string
// Queue is the queue that this want to listen to
Queue() string
// Consume return a channel to put jobs into
Consume(context.Context) chan<- Delivery
}
Consumer is the side the workers on it
type Delivery ¶
type Delivery interface {
Decode(v interface{}) error
// Ack delegates an acknowledgement through the Acknowledger interface that the client or server has finished work on a delivery.
Ack(multiple bool) error
// Nack negatively acknowledge the delivery of message(s) identified by the delivery tag from either the client or server.
Nack(multiple, requeue bool) error
// Reject delegates a negatively acknowledgement through the Acknowledger interface.
Reject(requeue bool) error
}
Delivery is the job to consumer
Click to show internal directories.
Click to hide internal directories.