transactional_outbox

package
v0.0.0-...-db1f2de Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: MIT Imports: 2 Imported by: 0

README

Transactional outbox

The transactional outbox pattern is a way to ensure that messages are sent to a message broker in a transactional manner. This means that the message is only sent if the transaction is committed successfully.

@startuml C4_Transactional_Outbox

!define C4PlantUML https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master
!include C4PlantUML/C4_Context.puml
!include C4PlantUML/C4_Container.puml
!include C4PlantUML/C4_Component.puml

LAYOUT_WITH_LEGEND()

' Define your system
System_Boundary(s1, "Your System") {
    ContainerDb(db1, "Database", "Relational DBMS", "Stores user data and outbox table")
    Container(app, "Application", "Your favorite technology", "Handles business logic")
    Container(mq, "Message Queue", "RabbitMQ/Kafka", "Buffers messages for asynchronous processing")
}

' Define external systems
System_Ext(externalService, "External Service", "Consumes messages for further processing")

' Show the transactional outbox pattern flow
Rel(app, db1, "Writes to", "1. Performs database transaction including write to outbox table")
Rel(db1, app, "Dispatch", "2. Outbox Poller reads and publishes messages", "Polling mechanism/Transaction log tailing")
Rel_L(app, mq, "3. Publishes messages to", "AMQP/Kafka client")
Rel(mq, externalService, "4. Sends messages to")

@enduml

References

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TransactionalOutbox

type TransactionalOutbox interface {
	// Publish publishes a message to the outbox
	Publish(ctx context.Context, msg v1.OutboxMessage) error

	// Poll polls the outbox for messages
	Poll(ctx context.Context) ([]v1.Outbox, error)
}

Directories

Path Synopsis
domain

Jump to

Keyboard shortcuts

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