Interface OutboxDeliveryHandler
OutboxEntryEntity's payload to its destination. The drainer
is generic — for each due row it calls deliver(KeycloakSession, OutboxEntryEntity)
and transitions the row based on the returned OutboxDeliveryResult.
One handler per registered entryKind; the drainer locates
a handler by the row's entryKind value. Implementations are
free to interpret the payload and metadata columns
however they like — the store treats both as opaque text.
Synchronous by design — the handler returns when delivery has
either succeeded, failed retryably, or failed terminally. Long-poll
or fire-and-forget delivery semantics should be modelled by
returning OutboxDeliveryResult.delivered() as soon as the
payload has been handed off (e.g. enqueued in an external broker).
-
Method Summary
Modifier and TypeMethodDescriptiondeliver(KeycloakSession session, OutboxEntryEntity row) Attempts delivery for one outbox row.TheentryKindthis handler is responsible for.
-
Method Details
-
entryKind
String entryKind()TheentryKindthis handler is responsible for. Must match theentry_kindcolumn of every row this handler will be invoked for; the drainer uses this to map locked rows back to a handler. -
deliver
Attempts delivery for one outbox row. The drainer holds a pessimistic write lock on the row for the duration of the call; implementations should keep the call bounded (no indefinite blocking) and avoid touching unrelated database rows so the lock window stays tight.Implementations may throw
RuntimeException; the drainer treats an uncaught exception asOutboxDeliveryOutcome.RETRYand records the exception class + message inlast_error.The returned
OutboxDeliveryResult'serrorMessage(if any) is persisted into the row'slast_errorcolumn. Handlers should pack as much diagnostic detail (HTTP status, response body excerpt, exception class) into that single string as fits the column (VARCHAR(2048)).
-