Documentation
¶
Index ¶
Constants ¶
const ( // DefaultIterationRate is the timeout after which all outbox events // in the outbox table are sent to the broker. // // Default: 5 * time.Second. DefaultIterationRate = 5 * time.Second // DebugMode enables additional logs for debug outbox process. // Now, this option do nothing. // // Default: false. DebugMode = false )
Variables ¶
var DefaultLogger = log.Default()
var ErrNoRecrods = errors.New("no records in the outbox")
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client provides possibility to set outbox record to the outbox table. Insertion must be in the same transaction as the produced action.
type Option ¶
type Option func(config) config
Option sets specific configuration to the Outbox.
func EnableDebugMode ¶
func EnableDebugMode() Option
func WithIterationRate ¶
WithIterationRate sets new interval for sending events from the outbox table.
func WithLogger ¶
WithLogger sets custom implementation of Logger.
type Outbox ¶
type Outbox struct {
// contains filtered or unexported fields
}
Outbox is struct that implement outbox pattern.
Writing all outgoing events in a temporary table in the same transaction in which we process the action associated with this event. Then we try to publish the event to the broker with specific timeout until the event is sent.
More about outbox pattern you can read at https://microservices.io/patterns/data/transactional-outbox.html.
type Record ¶
type Record struct {
// contains filtered or unexported fields
}
Record is event that should be processed by outbox worker.
func NewRecord ¶
NewRecord creates new record that can be processed by outbox worker.
Parameters:
id - is a unique id for outbox table. ID should be unique or storage will ignore all duplicate ids. eventType - is a topic to which event will be published. payload - the body to be published.