Documentation ¶
Index ¶
- func NewExchangeName(appName, exchangeName string) string
- func NewMessage(id string, body []byte) amqp.Publishing
- func NewQueueName(appName, appEnv, queueName string) string
- func Publish(ctx context.Context, exchange, key string, msg amqp.Publishing, ...) error
- type AckFailedError
- type ErrorHandler
- type Handler
- type HandlerNotFoundError
- type Middleware
- type NackFailedError
- type PanicRecoveryCallback
- type Pool
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewExchangeName ¶
NewExchangeName placeholder in format "{owner}.{name_you_desire}" example result: "subscriptions.primary"
func NewMessage ¶
func NewMessage(id string, body []byte) amqp.Publishing
NewMessage assumes body to be json, for other formats write own factory function
func NewQueueName ¶
NewQueueName placeholder in format: "{owner}.{ENV}.{name_you_desire}" example result: "subscriptions.prod.primary" ENV specification help you keep testing queues separate from production, and also run any debugging listening on production data
Types ¶
type AckFailedError ¶
type AckFailedError struct {
// contains filtered or unexported fields
}
func NewAckFailedError ¶
func NewAckFailedError(msg amqp.Delivery) *AckFailedError
func (*AckFailedError) Error ¶
func (err *AckFailedError) Error() string
type ErrorHandler ¶
ErrorHandler should handle error during Handler phase and return indicator of `requeue` i.e. should message be redelivered again
type Handler ¶
Handler is a function should be some kind of controller.Method where you can handle a kind of business logic or call underlying function and return error which will be handled by underlying ErrorHandler
type HandlerNotFoundError ¶
type HandlerNotFoundError struct {
// contains filtered or unexported fields
}
func NewHandlerNotFoundError ¶
func NewHandlerNotFoundError(msg amqp.Delivery) *HandlerNotFoundError
func (*HandlerNotFoundError) Error ¶
func (err *HandlerNotFoundError) Error() string
type Middleware ¶
func NewConsumerTraceLoggerMid ¶
func NewConsumerTraceLoggerMid() Middleware
NewConsumerTraceLoggerMid example of Middleware which logs a message into traces
func NewPanicRecoveryMiddleware ¶
func NewPanicRecoveryMiddleware(cb PanicRecoveryCallback) Middleware
func NewTracerMiddleware ¶
func NewTracerMiddleware() Middleware
type NackFailedError ¶
type NackFailedError struct {
// contains filtered or unexported fields
}
func NewNackFailedError ¶
func NewNackFailedError(msg amqp.Delivery) *NackFailedError
func (*NackFailedError) Error ¶
func (err *NackFailedError) Error() string
type PanicRecoveryCallback ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool is a generic container for keeping rabbitmq clients
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func NewRouter ¶
func NewRouter(errorHandler ErrorHandler, mids ...Middleware) *Router
func (*Router) GetEventNames ¶
func (*Router) RegisterEventHandler ¶
func (r *Router) RegisterEventHandler(eventName string, handler Handler, middlewares ...Middleware)