Class CortexBackupAutoConfiguration
This is the fourth delivery mechanism alongside CortexAutoConfiguration (the graph
itself), CortexWebAutoConfiguration (HTTP, to humans), and
CortexMcpAutoConfiguration (MCP, to agents) — it delivers the
graph to durable storage, on a schedule. It registers no graph beans of its own, which is what
keeps cortex.backup.enabled a single switch of the same shape as
cortex.web.enabled and cortex.mcp.enabled rather than a domain-grouped config.
Off by default, and unlike the other two it cannot simply be switched on: it needs
cortex.persistent=true, an enabled and configured CortexProperties.S3 client, and
dependencies the Cortex starter deliberately does not bring —
org.springframework.boot:spring-boot-starter-quartz, software.amazon.awssdk:s3, and
software.amazon.awssdk:apache-client. The starter brings what is on by default; this is
not.
Every one of those requirements is checked in this class's constructor, so a half-configured
backup fails the context at startup naming exactly what is missing. That matters more here than
anywhere else in Cortex: the alternative is an application that boots clean, reports healthy, and
simply never backs anything up — discovered only when someone needs a backup and finds an empty
bucket. The classpath checks in particular are deliberately not left to
@ConditionalOnClass back-off, which is the right default for a property nobody set and
the wrong one for a consumer who explicitly asked for backups.
The beans touching Quartz and the AWS SDK live in the imported BackupJobConfiguration,
behind @ConditionalOnClass, and the S3 client itself in CortexS3AutoConfiguration. This class deliberately names neither library in a method signature —
otherwise a missing optional dependency would surface as a NoClassDefFoundError while
Spring introspects this class, pre-empting the explanation the constructor is here to give.
-
Constructor Summary
ConstructorsConstructorDescriptionCortexBackupAutoConfiguration(CortexProperties properties) Creates the auto-configuration, validating that backups can actually run. -
Method Summary
-
Constructor Details
-
CortexBackupAutoConfiguration
Creates the auto-configuration, validating that backups can actually run.- Parameters:
properties- the Cortex configuration properties- Throws:
IllegalStateException- if the assertions are not persistent, if Quartz or the AWS SDK are missing from the classpath, if the S3 client is disabled or unconfigured, or if the backup interval is not positive
-