pubsubmux

package
v0.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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) Close

func (m *Mux) Close(ctx context.Context) error

Close the pubsub mux subscriptions.

func (*Mux) Run

func (m *Mux) Run() error

Run starts the router and begin on listening for given subscriptions.

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

func (m *Mux) WithMaxHandlers(maxHandlers int) *Mux

WithMaxHandlers sets up the maximum concurrent handlers number for the resultant Mux that would be used exclusively in its and it's children context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL