transactional

command
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

README

Transactional producer and consumer

This example keeps an application orders table and BlockQueue in the same SQLite database. It demonstrates two separate atomic boundaries:

Producer: INSERT order + PublishTx      -> one commit
Consumer: UPDATE order + AckDeliveryTx -> another commit, later

The producer transaction does not wait for the consumer. Once it commits, the order and delivery are durable and the consumer can claim the delivery.

The consumer performs work later. If its order update or receipt-fenced ACK fails, WithTx rolls both changes back. The unacknowledged delivery becomes eligible for retry after its lease expires.

Run it from the repository root:

go run ./example/transactional

Use this pattern only when the application tables and BlockQueue use the same physical database. Remote APIs, email, files, and other external side effects cannot participate in the database transaction and must be idempotent.

Documentation

Overview

Package main demonstrates transactional enqueueing and transactional delivery completion with BlockQueue and an application table in one SQLite database.

Jump to

Keyboard shortcuts

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