Skip to content

Add an API (and Actuator endpoint) to requeue FAILED outbox entries #148

Open

Description

@rawo

Problem

FAILED is terminal. Once an entry runs out of retries (for example after a downstream outage longer than the backoff budget, about 5 minutes with the defaults from #131), the only way to deliver it again is hand-written SQL. Since 2.0.0 that SQL also has to set next_attempt_at (see UPGRADING.md, "Requeuing a FAILED row by hand"):

UPDATE okapi_outbox
SET status = 'PENDING', retries = 0, next_attempt_at = CURRENT_TIMESTAMP  -- UTC_TIMESTAMP(6) on MySQL
WHERE status = 'FAILED' AND ...

This is easy to get wrong (forgetting next_attempt_at, retries or the UTC conversion on MySQL), and it is different for each database.

Proposal

  • Add a store operation, e.g. requeueFailed(filter, limit): Int, that moves matching FAILED rows back to PENDING with retries = 0, next_attempt_at = now and last_error kept for diagnosis. Filters could include delivery type, a last_attempt window, and/or explicit ids. Update in batches with a LIMIT, as removeDeliveredBefore does for deletes, so a large requeue does not hold locks on the whole table.
  • Expose it through the API (e.g. on OutboxProcessor or a small OutboxAdmin facade) and, in okapi-spring-boot, through an opt-in Actuator endpoint.
  • Implement it in PostgresOutboxStore and MysqlOutboxStore with contract tests in OutboxStoreContractTests.

Compatibility

Additive. Add it as a default method on OutboxStore / RouteAwareOutboxStore that throws UnsupportedOperationException (or as a separate optional interface) so custom stores keep compiling. Fits a 2.x minor release.

Split out of #131 (see the "Out of scope" section of #146).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions