Documentation ¶
Overview ¶
Package router contains a Router interface and Mux, message handler multiplexer, to allow for multiple message handlers to be assigned to multiple queues.
Index ¶
- Variables
- type Binder
- type Mux
- func (r *Mux) Bind(queue string, h handler.Handler)
- func (r *Mux) Group(fn func(Router)) Router
- func (r Mux) Handle(ctx context.Context, delivery amqp.Delivery) error
- func (r *Mux) Use(middlewares ...func(handler.Handler) handler.Handler)
- func (r *Mux) With(middlewares ...func(handler.Handler) handler.Handler) Binder
- type Router
Constants ¶
This section is empty.
Variables ¶
var ErrNoHandler = errors.New("router: no handler for the incoming message has been found")
ErrNoHandler is returned by Router.Handle method when no handler has been found for the incoming message.
Functions ¶
This section is empty.
Types ¶
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux is a multiplexer that implements the Router interface, to support multiple message handler functions for specific queues.
func (*Mux) Bind ¶
Bind binds a message handler function to the specified queue, if the handler is not nil.
func (*Mux) Group ¶
Group creates a new inline Router and fresh middleware stack, useful to group multiple handler bindings with same middlewares to be applied.
func (Mux) Handle ¶
Handle delegates message handling to the specific queue identified by the amqp.Delivery.ConsumerTag value.
type Router ¶
type Router interface { Binder handler.Handler Group(func(Router)) Router Use(middlewares ...func(handler.Handler) handler.Handler) With(middlewares ...func(handler.Handler) handler.Handler) Binder }
Router is a message handler extension that supports middlewares and multiple consumer bindings.