Documentation
¶
Index ¶
- type Mux
- func (m *Mux) Close(ctx context.Context) error
- func (m *Mux) Run() error
- func (m *Mux) Subscribe(subject string, hf xpubsub.HandlerFunc)
- func (m *Mux) Subscription(sub *pubsub.Subscription, hf xpubsub.HandlerFunc, subject ...string)
- func (m *Mux) Use(middleware ...xpubsub.Middleware)
- func (m *Mux) With(middlewares ...xpubsub.Middleware) *Mux
- func (m *Mux) WithMaxHandlers(maxHandlers int) *Mux
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux is a subscriber router. It provides an easy interfaces for starting and listening on the subscriptions. Implements xservice.RunnerCloser interface.
func NewMux ¶
func NewMux() *Mux
NewMux creates a new mux that will register subscriptions using provided subscriber factory.
func (*Mux) Subscribe ¶
func (m *Mux) Subscribe(subject string, hf xpubsub.HandlerFunc)
Subscribe registers subject subscriber that handles the message using provided handler with given options.
func (*Mux) Subscription ¶
func (m *Mux) Subscription(sub *pubsub.Subscription, hf xpubsub.HandlerFunc, subject ...string)
Subscription registers subscription with specific handler. Optionally the subject name might be set for the logging and context passing purpose.
func (*Mux) Use ¶
func (m *Mux) Use(middleware ...xpubsub.Middleware)
Use provides middlewares to be used for all routes and children groups.
func (*Mux) With ¶
func (m *Mux) With(middlewares ...xpubsub.Middleware) *Mux
With sets the middlewares for the resultant Mux that would be used exclusively in its and it's children context.
func (*Mux) WithMaxHandlers ¶
WithMaxHandlers sets up the maximum concurrent handlers number for the resultant Mux that would be used exclusively in its and it's children context.