queuefx

package
v0.6.12 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBroker = "default"

Variables

View Source
var (
	ErrUnknownProvider          = errors.New("unknown provider")
	ErrUnableToDetermineDialect = errors.New("unable to determine dialect")
)

Functions

This section is empty.

Types

type AmqpBroker

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

func NewAmqpBroker

func NewAmqpBroker(ctx context.Context, dialect Dialect, dsn string) (*AmqpBroker, error)

func (*AmqpBroker) GetDialect

func (broker *AmqpBroker) GetDialect() Dialect

func (*AmqpBroker) Publish

func (broker *AmqpBroker) Publish(ctx context.Context, name string, body []byte) error

func (*AmqpBroker) QueueDeclare

func (broker *AmqpBroker) QueueDeclare(ctx context.Context, name string) (string, error)

type Broker

type Broker interface {
	GetDialect() Dialect

	QueueDeclare(ctx context.Context, name string) (string, error)
	Publish(ctx context.Context, name string, body []byte) error
}

type Config

type Config struct {
	Brokers map[string]ConfigBroker `conf:"BROKERS"`
}

type ConfigBroker

type ConfigBroker struct {
	Provider string `conf:"PROVIDER"`
	DSN      string `conf:"DSN"`
}

type Dialect

type Dialect string
const (
	DialectAmqp Dialect = "amqp"
)

func DetermineDialect

func DetermineDialect(provider string, dsn string) (Dialect, error)

type Registry

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

func NewRegistry

func NewRegistry(logger *slog.Logger) *Registry

func (*Registry) AddConnection

func (registry *Registry) AddConnection(ctx context.Context, name string, provider string, dsn string) error

func (*Registry) GetDefault added in v0.6.11

func (registry *Registry) GetDefault() Broker

func (*Registry) GetNamed added in v0.6.11

func (registry *Registry) GetNamed(name string) Broker

func (*Registry) LoadFromConfig

func (registry *Registry) LoadFromConfig(ctx context.Context, config *Config) error

Jump to

Keyboard shortcuts

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