outbox
Generated by tinox doc
tinox.core.outbox: transactional outbox over tinox.core.db and AMQP 0-9-1 publisher confirms.
| Module | Version | Group |
|---|---|---|
db | 1.2.2 | tinox.core |
amqp091 | 1.3.0 | tinox.core |
class Outbox
* Writing side of the transactional outbox. add() stores the message in table `tinox_outbox` with * the ORM, i.e. on the connection of the caller's @Transactional method: the message is committed * or rolled back together with the business data, never separately. Nothing is sent here.
Methods
class OutboxDispatcher
* Publishing side of the outbox: reads pending records (oldest first, 50 per batch), publishes each to * its queue with the record's messageId as AMQP message-id using publisher confirms, and marks it sent * only after the broker confirmed it. * * Delivery is AT-LEAST-ONCE. If the process dies after the broker confirmed but before the record is * marked sent (or the confirm is lost), the record is published again after a restart, with the same * messageId: consumers must deduplicate on it (IdempotencyWindow091 or a unique key in their database). * No committed record is lost: a record stays pending until a confirm was seen. Failures are retried with * exponential backoff (backoffMs * 2^attempts, capped at 60 s) and parked after maxAttempts, so nothing * retries forever. Order is by id, but a record in backoff is overtaken by later ones.
Fields
host | String | |
port | Int64 | |
vhost | String | |
user | String | |
pass | String | |
maxAttempts | Int64 | |
backoffMs | Int64 | |
confirmTimeoutMs | Int64 | |
conns | List<AmqpConnection091> | |
chans | List<AmqpChannel091> | |
connected | Bool | |
stopRequested | Bool | |
confirmed | Int64 | |
failures | Int64 |
Methods
@Entity@Tableclass OutboxRecord
* One message waiting to be published. Written by Outbox::add inside the application's own * transaction, published (and marked sent) later by the OutboxDispatcher. * * Table `tinox_outbox`; create it in your changelog, see docs/outbox.md. * status: 0 pending, 1 sent (broker confirmed), 2 parked (maxAttempts failed -- needs an operator).
Fields
@Id@GeneratedValueid | Int64 | |
@Columndestination | String | |
@ColumnmessageId | String | |
@Columnpayload | String | |
@Columnstatus | Int64 | |
@Columnattempts | Int64 | |
@ColumnlastError | String | |
@ColumncreatedAt | Int64 | |
@ColumnnextAttemptAt | Int64 | |
@ColumnsentAt | Int64 |