messaging

package module
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWatermillLogger added in v1.1.0

func NewWatermillLogger() watermill.LoggerAdapter

NewWatermillLogger creates a new WatermillLogger instance.

Types

type BrokerCQRS

type BrokerCQRS interface {
	// Start starts the broker.
	// All Command and Event handlers must be added before calling this method.
	Start(ctx context.Context) error

	// Stop stops the broker.
	Stop(ctx context.Context) error

	// Running is closed when broker is running.
	// In other words: you can wait till broker is running using
	//
	//	fmt.Println("Starting broker")
	//	go r.Run(ctx)
	//	<- r.Running()
	//	fmt.Println("Broker is running")
	//
	// Warning: for historical reasons, this channel is not aware of broker closing.
	// The channel will be closed if the broker has been running and closed.
	Running(ctx context.Context) chan struct{}

	// AddCommandHandlers adds command handlers to the command processor.
	AddCommandHandlers(ctx context.Context, handlers ...cqrs.CommandHandler) error

	// AddEventHandlers adds event handlers to the event processor.
	AddEventHandlers(ctx context.Context, handlers ...cqrs.EventHandler) error

	// SendCommand sends a command to the command bus.
	SendCommand(ctx context.Context, command any) error

	// SendEvent sends an event to the event bus.
	SendEvent(ctx context.Context, event any) error
}

BrokerCQRS is a contract for a message broker that implements the CQRS pattern.

type PubSub

type PubSub interface {
	message.Publisher
	message.Subscriber
}

PubSub is a contract for a message broker that implements both Publisher and Subscriber.

type WatermillLogger added in v1.1.0

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

WatermillLogger is a logger adapter for the Watermill library.

func (*WatermillLogger) Debug added in v1.1.0

func (l *WatermillLogger) Debug(msg string, fields watermill.LogFields)

Debug logs a debug message with the given fields.

func (*WatermillLogger) Error added in v1.1.0

func (l *WatermillLogger) Error(_ string, err error, fields watermill.LogFields)

Error logs an error message with the given fields.

func (*WatermillLogger) Info added in v1.1.0

func (l *WatermillLogger) Info(msg string, fields watermill.LogFields)

Info logs an info message with the given fields.

func (*WatermillLogger) Trace added in v1.1.0

func (l *WatermillLogger) Trace(msg string, fields watermill.LogFields)

Trace logs a trace message with the given fields.

func (*WatermillLogger) With added in v1.1.0

With adds fields to be logged in all log messages.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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