Repository navigation
Conversation
SendAsynchronousEventsTasklet read and sent exactly one batch per run and then returned FINISHED. With the defaults (cron every minute, external-event-batch-size 1000) the job therefore sent at most 1000 events per minute, about 17 events/s, although a run takes only 0.12-0.28 s. Add fineract.events.external.max-batches-per-run (default 1, which keeps the current behavior). A run now reads up to that many batches, sending and marking each batch as sent before reading the next, and stops early as soon as a batch is not full (the backlog is drained). If a send fails, the failed batch stays TO_BE_SENT and the run stops, exactly as before. Tests: default keeps one batch per run; exactly N batches when the backlog is larger; stops at a partial batch; a failure in the second batch marks only the first batch as sent.
jenny1371
force-pushed
the
events-drain-batches
branch
from
October 9, 2026 04:00
ebc7469 to
7a7eb9c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
JIRA: https://issues.apache.org/jira/browse/FINERACT-2900
SendAsynchronousEventsTaskletreads and sends exactly one batch per run and then returnsFINISHED. With the defaults (cron every minute,external-event-batch-size= 1000) the external events job therefore sends at most 1000 events per minute, even though a run only takes 0.12-0.28 s.This adds
fineract.events.external.max-batches-per-run(envFINERACT_EXTERNAL_EVENTS_MAX_BATCHES_PER_RUN, default 1, so the current behavior is unchanged). A run reads up to that many batches. Each batch is sent and marked as sent before the next one is read, and the run stops as soon as a batch is not full (backlog drained). If a send fails, the failed batch staysTO_BE_SENTand the run stops, exactly as today.Measured (custom image built from this branch, PostgreSQL + Kafka, backlog of 12,000
TO_BE_SENTevents, batch size 1000, default cron)max-batches-per-run=1(control, today's behavior)max-batches-per-run=20Per 1000-event batch (DEBUG timings): read 10-15 ms, message creation 90-300 ms, Kafka send ~25 ms, mark as sent 10-20 ms.
Tests
SendAsynchronousEventsTaskletTest: default reads one batch; exactly N batches when the backlog is larger; stops at a partial batch; a failure on the 2nd batch marks only the first batch as sent../gradlew :fineract-provider:spotlessCheckand the test class pass on JDK 25.Checklist