outbox

package
v0.0.0-...-b1203ac Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enqueue

func Enqueue(ctx context.Context, evt ...Event) bool

Enqueue enqueues the events to the outbox.

Types

type Event

type Event interface {
	ID() string
	AggregateID() string
	AggregateType() string
	Type() string
	Payload() json.RawMessage
}

Event is an outbox event. We use interface to allow hiding the actual event implementation. The format is based on here: https://debezium.io/blog/2019/02/19/reliable-microservices-data-exchange-with-the-outbox-pattern/

type Message

type Message struct {
	ID            string
	AggregateID   string
	AggregateType string
	Typ           string
	Payload       json.RawMessage
}

func (*Message) AsEvent

func (m *Message) AsEvent() Event

type Outbox

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

func New

func New(atm atomic, wf writerFlusher) *Outbox

func (*Outbox) RunInTx

func (o *Outbox) RunInTx(ctx context.Context, fn func(context.Context) error) error

Jump to

Keyboard shortcuts

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