Documentation
¶
Index ¶
- type Context
- type ExchageType
- type Exchange
- type Handler
- type MMQ
- func (m *MMQ) Close()
- func (m *MMQ) Connect() (err error)
- func (m *MMQ) Consume(q string, handler Handler)
- func (m *MMQ) DeclareExchange(name string, exchangeType ExchageType, durable bool)
- func (m *MMQ) DeclareExchanges(exchanges ...Exchange)
- func (m *MMQ) DeclareQueue(name, exchange, routingKey string)
- func (m *MMQ) DeclareQueues(queues ...Queue)
- func (m *MMQ) GetQueue(name string) *queue.Queue
- func (m *MMQ) GetQueues() map[string]*queue.Queue
- func (m *MMQ) Listen()
- func (m *MMQ) Publish(q, e string, message []byte, headers amqp.Table) error
- type Queue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
func (*Context) Ack ¶
Ack the message This will acknowledge the message and remove it from the queue @param multiple If true, will acknowledge all messages up to this one
func (*Context) Nack ¶
Nack the message This will not acknowledge the message and remove it from the queue @param multiple If true, will acknowledge all messages up to this one @param requeue If true, will requeue the message
func (*Context) Reject ¶
Reject the message This will not acknowledge the message and remove it from the queue @param requeue If true, will requeue the message
func (*Context) SendResponse ¶
SendResponse sends a response to the message This will send a response to the message and acknowledge the message @param message The message to send as a response @param headers The headers to send with the message
type ExchageType ¶
type ExchageType int
const ( ExchangeTypeDirect ExchageType = 0 ExchangeTypeFanout ExchageType = 1 ExchangeTypeTopic ExchageType = 2 )
type Exchange ¶
type Exchange struct {
Name string
Type ExchageType
Durable bool
}
Exchange is a struct that contains the name, type and durability of an exchange
type Handler ¶
type Handler func(ctx *Context)
Handler is a function that is called when a message is received
type MMQ ¶
type MMQ struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new instance of the MMQ package @param connection The connection URL to the RabbitMQ server @return *MMQ
func (*MMQ) Consume ¶
Consume a queue with a handler function The handler function will be called with a message context - @param q The name of the queue - @param handler The handler function
func (*MMQ) DeclareExchange ¶
func (m *MMQ) DeclareExchange(name string, exchangeType ExchageType, durable bool)
DeclareExchange declares an exchange with a name, type and durability @param name The name of the exchange @param exchangeType The type of the exchange @param durable Whether the exchange is durable or not
func (*MMQ) DeclareExchanges ¶
DeclareExchanges declares multiple exchanges @param exchanges The exchanges to declare
func (*MMQ) DeclareQueue ¶
DeclareQueue declares a queue with a name, exchange and routing key @param name The name of the queue @param exchange The name of the exchange @param routingKey The routing key
func (*MMQ) DeclareQueues ¶
DeclareQueues declares multiple queues @param queues The queues to declare
func (*MMQ) GetQueue ¶
GetQueue returns a queue by name @param name The name of the queue @return *queue.Queue