Guarantee a minimum delay on processing retries of outbox events

Description

Improve the algorithm of to guarantee a minimum delay on processing retries of outbox events.
This could lead to a more efficient error handling in case of multiple servers / multiple routings on different points of failures.

See comments about how to implement this.

See conversation here: https://hibernate.zulipchat.com/#narrow/stream/132092-hibernate-search-dev/topic/HSEARCH-4134/near/230862088

Activity

Show:

Yoann Rodière November 2, 2021 at 8:44 AM
Edited

Implementation:

  • Add a processAfter property to OutboxEvent, of type Instant

  • Make sure to add a database index to that column

  • Set that column to null for initial (non-errored) events

  • Set that column to Instant.now() + some configurable delay for errored events
    IMPORTANT: do NOT try to generate the Instant using SQL in this case. Just use Java code. It’s not the same context as the last time we previously introduced an Instant column in OutboxEvent, and thus we don’t have the same constraints.

  • In DefaultOutboxEventFinder, add a condition to the query : WHERE processAfter < :processingTime, and set processingTime to Instant.now(). Don’t try to use the JPQL/HQL/SQL now() function, that's more trouble than it's worth in this case.

This will need testing. Make sure to test this properly.

Fixed

Details

Assignee

Reporter

Components

Sprint

Fix versions

Priority

Created March 19, 2021 at 8:46 AM
Updated July 22, 2022 at 6:32 AM
Resolved November 15, 2021 at 8:49 AM