dispatch

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RawRequest

type RawRequest struct {
	// contains filtered or unexported fields
}

func NewRawRequest

func NewRawRequest(ctx context.Context, msgType wasabi.MessageType, data []byte) *RawRequest

func (*RawRequest) Context

func (r *RawRequest) Context() context.Context

func (*RawRequest) Data

func (r *RawRequest) Data() []byte

func (*RawRequest) RoutingKey

func (r *RawRequest) RoutingKey() string

func (*RawRequest) WithContext

func (r *RawRequest) WithContext(ctx context.Context) wasabi.Request

type RequestHandlerFunc

type RequestHandlerFunc func(conn wasabi.Connection, req wasabi.Request) error

RequestHandlerFunc is a function that implements RequestHandler interface

func (RequestHandlerFunc) Handle

Handle implements RequestHandler interface

type RequestMiddlewere

type RequestMiddlewere func(next wasabi.RequestHandler) wasabi.RequestHandler

RequestMiddlewere is interface for request middleweres

type RequestParser

type RequestParser func(conn wasabi.Connection, ctx context.Context, msgType wasabi.MessageType, data []byte) wasabi.Request

type RouterDispatcher

type RouterDispatcher struct {
	// contains filtered or unexported fields
}

func NewRouterDispatcher

func NewRouterDispatcher(defaultBackend wasabi.RequestHandler, parser RequestParser) *RouterDispatcher

NewRouterDispatcher creates a new instance of RouterDispatcher. It takes a defaultBackend and a request parser as parameters and returns a pointer to RouterDispatcher. The defaultBackend parameter is the default backend to be used when no specific backend is found. The parser parameter is used to parse incoming requests.

func (*RouterDispatcher) AddBackend

func (d *RouterDispatcher) AddBackend(backend wasabi.RequestHandler, routingKeys []string) error

AddBackend adds a backend to the RouterDispatcher for the specified routing keys. If a backend already exists for any of the routing keys, an error is returned.

func (*RouterDispatcher) Dispatch

func (d *RouterDispatcher) Dispatch(conn wasabi.Connection, msgType wasabi.MessageType, data []byte)

Dispatch handles the incoming connection and data by parsing the request, determining the appropriate backend, and handling the request using middleware. If an error occurs during handling, it is logged.

func (*RouterDispatcher) Use

func (d *RouterDispatcher) Use(middlewere RequestMiddlewere)

Use adds a middleware to the router dispatcher. Middleware functions are executed in the order they are added.

Jump to

Keyboard shortcuts

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