Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Closer ¶
type Closer interface { // Close closes the AMQP connection and channel(s). // // This SHOULD be called, AMQP 0-9-1 asks for gracefully closing connections. // https://www.rabbitmq.com/tutorials/amqp-concepts.html#amqp-connections // Channels close with their connection. // // TODO(ilazakis): test we close on cleanup (worker, progress, api) Close() error }
Closer closes a pub/sub connection. Safe to call multiple times.
type Publisher ¶
type Publisher interface { Closer // Publish publishes an event to the `Publisher`'s exchange. // Events are marshaled into `JSON` before publishing. Publish(msg interface{}, routingKey string) error }
A Publisher publishes messages/events of arbitrary type. to its exhange under the provided routing key.
type RabbitMQ ¶
type RabbitMQ struct {
// contains filtered or unexported fields
}
RabbitMQ `Client` implementation.
func NewRabbitMQ ¶
func NewRabbitMQ(exchange, user, pass, host string, port int64, retryInterval time.Duration) (*RabbitMQ, error)
NewRabbitMQ - RabbitMQ client initializer.
func (*RabbitMQ) Close ¶
Close closes the Rabbit MQ connection and channel(s).
This SHOULD be called, AMQP 0-9-1 asks for gracefully closing connections. https://www.rabbitmq.com/tutorials/amqp-concepts.html#amqp-connections Channels close with their connection.
TODO(ilazakis): test to verify we close on cleanup.
func (*RabbitMQ) Subscribe ¶
func (c *RabbitMQ) Subscribe(queue, routingKey string, prefetchCount int, messageCallback func(body []byte, ack func(ok bool, requeue bool))) error
Subscribe declares the queue and binds the queue/routing key pair to an exchange.
Use the messageCallback function to handle and ack the message.
type Subscriber ¶
type Subscriber interface { Closer // Subscribe declares the queue and binds the queue/routing key pair to an exchange. // // Use the messageCallback function to handle and ack incoming messages. Subscribe(queue, routingKey string, prefetchCount int, messageCallback func(body []byte, ack func(ok bool, requeue bool))) error }
A Subscriber listens for messages/events.