gtbx

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCounters

func WithCounters(successCtr metrics.Counter, errorCtr metrics.Counter) opt

WithCounters allows clients to configure optional counters to monitor outbox delivery outcome.

func WithLogger

func WithLogger(l logger.Logger) opt

WithLogger allows clients to configure an optional logger.

Types

type Goutbox

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

Goutbox implements the Goutbox module.

func Singleton

func Singleton(s Settings, r repository.Repository, e emitter.Emitter, options ...opt) *Goutbox

Singleton creates a unique instance of Goutbox using the provided settings and options and the provided Repository and an Emitter implementations.

func (*Goutbox) Publish

func (g *Goutbox) Publish(ctx context.Context, o *Outbox) error

Publish publishes a domain event reliably within a business transaction, utilizing the polling publisher variant of the Transactional Outbox pattern. An opened database transaction is expected to be in the provided context. Take a look to the different repository implementations to see the expected transaction type in each case.

type Outbox

type Outbox struct {
	AggregateType string // the aggregate type (e.g. "Restaurant")
	AggregateId   string // the aggregate identifier
	EventType     string // the event type (e.g "RestaurantCreated")
	Payload       []byte // event payload
}

Outbox contains high level information about a domain event and should be provided by the clients.

type Settings

type Settings struct {
	EnableDispatcher     bool          // enables the dispatcher using the polling publisher pattern
	MaxDispatchers       int           // in HA environments, maximum allowed number of dispatchers working concurrently
	PollingInterval      time.Duration // interval between database pollings by the dispatchers
	MaxEventsPerInterval int           // maximum number of events to be processed by a dispatcher in each iteration (-1 = unlimited)
	MaxEventsPerBatch    int           // maximum number of events per batch
}

Settings holds the general Goutbox module configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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