jenny1371 opened a new pull request, #6590: URL: https://github.com/apache/fineract/pull/6590
## Description JIRA: https://issues.apache.org/jira/browse/FINERACT-2900 `SendAsynchronousEventsTasklet` reads and sends exactly one batch per run and then returns `FINISHED`. 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` (env `FINERACT_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 stays `TO_BE_SENT` and the run stops, exactly as today. ## Measured (custom image built from this branch, PostgreSQL + Kafka, backlog of 12,000 `TO_BE_SENT` events, batch size 1000, default cron) | Setting | Result | |---|---| | `max-batches-per-run=1` (control, today's behavior) | exactly 1000 events per run, runs 60 s apart, so 12,000 events take 12 minutes | | `max-batches-per-run=20` | all 12,000 events sent in one run, about 4 s of job time | Per 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:spotlessCheck` and the test class pass on JDK 25. ## Checklist - [x] Write the commit message as per our guidelines - [x] Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers. - [x] Create/update unit or integration tests for verifying the changes made. - [x] Follow our coding conventions. - [x] Add required Swagger annotation and update API documentation (no API change) - [x] This PR must not be a "code dump". - [x] If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately. - [x] I followed the AI Policy. (Generative AI assisted; disclosed with an Assisted-By trailer in the commit.) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
