endpoint

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmqpEndpoint

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

AmqpEndpoint uses amqp transport to send out a message.

func (AmqpEndpoint) Name

func (a AmqpEndpoint) Name() string

func (AmqpEndpoint) Send

type DeliveryOption

type DeliveryOption func(o *deliveryOptions)

func WithDelay

func WithDelay(delay time.Duration) DeliveryOption

WithDelay option waits specified duration before delivering a message

type Endpoint

type Endpoint interface {
	// Name is a unique name of the endpoint
	Name() string
	// Send sends a message with specified implementation
	Send(ctx context.Context, message *message.OutcomingMessage, options ...DeliveryOption) error
}

Endpoint knows where to deliver a message

func NewAmqpEndpoint

func NewAmqpEndpoint(name string, amqpTransport transport.Transport, destination transport.DeliveryDestination, msgMarshaller message.Marshaller) Endpoint

NewAmqpEndpoint creates new instance of AmqpEndpoint

type Router

type Router interface {
	// RegisterEndpoint assigns types of objects to an endpoint
	RegisterEndpoint(endpoint Endpoint, objects ...message.Object)
	// Route returns a list of endpoints that were assigned to a type of object
	Route(obj message.Object) []Endpoint
}

Router is a registry of Endpoints and types. Each type can have multiple endpoints assigned.

func NewRouter

func NewRouter() Router

NewRouter creates new instance of Router with default implementation

Jump to

Keyboard shortcuts

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