Build reliable, distributed transaction processing systems using the http4k Transactional Outbox pattern
Process HTTP requests asynchronously using the Transactional Outbox pattern - store-and-forward with database-backed reliability.
The same level of testability as the rest of your http4k application, with in-memory implementations and plain HttpHandler composition.
Use the same mechanism for outgoing messages (outbox) or incoming work (inbox) - swap your client or handler for a PostboxHandlers interceptor.
Database transactions, retries with incremental backoff, and a claim-lease model so concurrent processors never double-handle work.
Step 1 - To implement a Transactional Outbox, replace your HTTP client or handler with a PostboxHandlers interceptor. Requests are stored transactionally and returned as 202 Accepted.
Step 2 - Create the storage with JdbcPostboxSchema.create(datasource) and wrap it in a PostboxTransactor for transactional processing.
Step 3 - Run PostboxProcessing in the background to claim pending requests, process them with your HttpHandler, and store the responses.
Step 4 - Serve the stored responses with the Postbox status handler - consume them immediately or later, with idempotent retries.
http4k Postbox is available under the http4k Commercial License. Free for qualifying small businesses (under $1M ARR), non-commercial, non-profit, and research use. Checkout is handled securely by Stripe.
All http4k Pro modules are also automatically included with the Enterprise Edition. Need bulk seats, team licensing, or custom terms? Get in touch.
