ores.scheduler.core

Table of Contents

1. Diagram

ores.scheduler.core component diagram

Figure 1: ores.scheduler.core

2. Summary

ores.scheduler.core provides cron-based job scheduling for ORE Studio. It manages job definitions (cron expressions, target actions) and job instances (execution history, status), runs a persistent scheduler loop that fires due jobs, and exposes NATS handlers for querying and managing jobs at runtime. It supports SQL and NATS-publish action types, making it the general-purpose periodic-operation backbone for the platform.

The job-definition entity stack – repository, mapper, entity, service, handler, sub-registrar, history provider and the presentation field mapper – is generated from the entity model. The hand-written code here is the infrastructure generation does not reach: the scheduler loop, the cron evaluator, the action handlers, the messaging registrar that composes the generated sub-registrar with the two hand-written view handlers, and the job-instance repository.

3. Inputs

  • NATS request messages for job-definition CRUD, the version reads, the two operational views, and the executions the loop serves.
  • PostgreSQL connections to ores_scheduler_* tables for job persistence.
  • System clock for evaluating cron expressions.

4. Outputs

  • Job-definition and job-instance records persisted to the ores_scheduler schema.
  • Triggered actions: SQL statements executed, or NATS messages published, per job schedule.
  • NATS response messages returned to callers, and a change event per job definition write.

5. Entry points

  • include/ores.scheduler.core/ores.scheduler.hpp — namespace documentation.
  • include/ores.scheduler.core/messaging/registrar.hpp — composes every NATS handler the component serves: the generated job-definition registrar, the two view handlers, and the generic history handler.
  • include/ores.scheduler.core/messaging/job_definition_registrar.hpp — the generated job-definition handlers.
  • include/ores.scheduler.core/messaging/job_instance_handler.hpp — the global job-instance list.
  • include/ores.scheduler.core/messaging/scheduler_status_handler.hpp — the live scheduler status.
  • include/ores.scheduler.core/service/scheduler_loop.hpp — the main scheduling loop driven by the service host.

6. Dependencies

  • ores.scheduler.api — domain types, the generated protocol, and the generated entity artefacts.
  • ores.database — connections, the request context, and the bitemporal repository operations.
  • ores.nats — NATS client, subscriptions and wire codec.
  • ores.service — request context, handler helpers and permission checks.
  • ores.history.core — the generic history provider registry.
  • ores.eventing.api — the change event published when a job fires.
  • ores.utility, ores.security, ores.logging, ores.platform — shared types, token validation, logging and time formatting.
  • croncpp — cron expression parsing and next-occurrence computation.
  • libfort — the table rendering of the domain types.

7. Build dependencies

What the shared profile cannot know, declared here rather than hand-edited into the generated build file. Each block is spliced into its generated file after the profile's baseline.

8. See also

9. Test dependencies

The suites link what the profile cannot know about.

target_link_libraries(${lib_target_name}
    PUBLIC
        ores.scheduler.api.lib
        ores.database.lib
        ores.nats.lib
    PRIVATE
        ores.eventing.api.lib
        ores.history.core.lib
        ores.service.lib
        ores.utility.lib
        ores.security.lib
        ores.logging.lib
        ores.platform.lib
        croncpp::croncpp
        libfort::fort)
target_link_libraries(${tests_target_name}
    PRIVATE
        ${lib_target_name}
        ores.eventing.api.lib
        ores.eventing.core.lib
        ores.nats.lib
        ores.refdata.core.lib
        ores.telemetry.core.lib
        ores.utility.lib
        ores.testing.lib
        ores.logging.lib
        Catch2::Catch2
        faker-cxx::faker-cxx
        ores.openssl_cleanup
        Threads::Threads)

Emacs 29.3 (Org mode 9.6.15)