Intent declarative glue: scheduled activities (cron → query → notify) - #6053
Merged
Conversation
Adds the `schedules:` block of the declarative-glue catalog: on a cron tick, query an entity with a typed Criteria and notify per matching row - the "overdue reminders" pattern, no hand-written code. - ScheduleIntent / ScheduleConditionIntent model + parser validation (unique name, cron, declared entity, supported where operators, valid notify). - ScheduleSupport.criteriaExpression (pure, unit-tested) builds the typed Criteria chain from `where` (eq/ne/gt/ge/lt/le/like; field names PascalCased to entity properties; CURRENT_DATE/CURRENT_TIMESTAMP -> now()). - GlueIntentGenerator emits a `schedules` collection into <intent>.glue; the per-row notify reuses NotificationSupport.plan against the row entity (same relation-load + interpolation as notifications). Job.java.template renders a @scheduled JobHandler that runs `new <Entity>Repository().findAll(Criteria...)` and sends per row; generateUtils.js gets the `schedules` collection case. Honors the .settings override. Builds on the merged typed Criteria API and the notifications machinery. Covered by ScheduleSupportTest + IntentEngineIT (the generated @scheduled job queries via Criteria and notifies per row) - green locally. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Adds the
schedules:block of the declarative-glue catalog — the "overdue reminders" pattern. On a cron tick, query an entity and notify per matching row, with no hand-written code:→ generates
gen/events/OverdueLoansJob.java: a@ScheduledJobHandlerthat runsnew LoanRepository().findAll(Criteria…)and notifies per row.How (heavy reuse of the just-merged foundation)
ScheduleSupport.criteriaExpression(pure, unit-tested) builds the typedCriteriachain fromwhere(the query API from Typed Criteria query API on JavaRepository (intent glue foundation) #6050) — field names PascalCased to the entity properties;CURRENT_DATE/CURRENT_TIMESTAMP→now().notifyreusesNotificationSupport.plan(from Intent declarative glue: notifications (event → email @Listener) #6052) against the row entity — same relation-load +{field}/{relation.field}interpolation as notifications.GlueIntentGeneratoremits aschedulescollection into<intent>.glue;Job.java.templaterenders the@Scheduled JobHandler;generateUtils.jsgets theschedulescollection case. Parser validates name/cron/entity/operators/notify; honors the.settingsoverride.Testing
ScheduleSupportTest—Criteriabuilding (operators, PascalCase fields, date tokens, numbers) — green.IntentEngineIT.glue_template_generates_…extended: asserts the generatedStaleOrdersJobis@Scheduled, queries viaCriteria.create().lt("OrderDate", java.time.LocalDate.now()), loads the relatedCustomer, andMail.sends per row — green locally (Tests run: 1, Failures: 0). CI runs the full suite on H2/PostgreSQL/MSSQL.Scope / gaps
Action is
notifyonly;between/inoperators and processtrigger: { onSchedule: <cron> }(timer start event) are later increments.🤖 Generated with Claude Code