Infrastructure Configuration

Detailed property reference for Contexa's infrastructure layer — caching, Redis pub/sub and streams, Kafka event topics, and OpenTelemetry observability. These properties control how Contexa communicates with external systems in a distributed deployment.

Enable distributed mode (PoC / enterprise demo) — Run contexa init --distributed and the CLI will:

  1. Dependencies — automatically add spring-kafka and redisson to your build file.
  2. Infrastructure — generate a docker-compose.yml with PostgreSQL + Ollama + Redis + Kafka + Zookeeper.
  3. Configuration — set contexa.infrastructure.mode: DISTRIBUTED and the Redis / Kafka hosts inside the Contexa-managed block of application.yml.

The properties on this page apply once distributed mode is enabled. For production, use Kubernetes + Helm.

Contexa Core Properties (Summary)

The top-level ContexaProperties class (prefix contexa) contains the master switches for infrastructure mode, Redis, Kafka, and observability. These properties are fully documented on the Configuration Overview page. Key infrastructure-related entries include:

Property Type Default Description
contexa (master)
contexa.enabled boolean true Top-level master switch for the entire Contexa auto-configuration. When false, every sub-module is disabled.
contexa.infrastructure
.mode enum STANDALONE STANDALONE (in-memory) or DISTRIBUTED (Redis/Kafka)
.redis.enabled boolean true Enable Redis for distributed caching and pub/sub
.kafka.enabled boolean true Enable Kafka for event streaming in distributed mode
.observability.enabled boolean true Enable observability infrastructure
.observability.open-telemetry-enabled boolean true Enable OpenTelemetry for distributed tracing

See the Configuration Overview for the complete ContexaProperties reference.

Cache Properties

Properties under contexa.cache, bound to ContexaCacheProperties. Controls the multi-tier caching subsystem used throughout Contexa for identity, policy, and behavioral data. Supports local (Caffeine), Redis, and hybrid caching strategies with optional pub/sub-based cache invalidation.

General Settings

Property Type Default Description
contexa.cache
.type CacheType REDIS LOCAL, REDIS, or HYBRID (L1 local + L2 Redis)
.local.max-size int 1000 Max entries in the local (L1) cache
.local.default-ttl-seconds int 60 Default TTL (seconds) for local cache entries
.redis.default-ttl-seconds int 300 Default TTL (seconds) for Redis cache entries
.redis.key-prefix String contexa:cache: Prefix for all Redis cache keys (namespace isolation)
.pubsub.enabled boolean true Enable pub/sub cache invalidation across cluster nodes
.pubsub.channel String contexa:cache:invalidation Pub/sub channel for cache invalidation broadcasts

Domain-Specific TTL

Each cache domain can have independent TTL values for local and Redis tiers. This allows fine-grained control — for example, frequently changing policy data can use shorter TTLs while stable HCAD baseline data uses longer ones.

Property Type Default Description
contexa.cache.domains
.users TtlConfig local: 3600 / redis: 3600 User identity and profile data
.roles TtlConfig local: 14400 / redis: 14400 Role definitions and permission mappings
.permissions TtlConfig local: 28800 / redis: 28800 Permission grants and access control entries
.groups TtlConfig local: 14400 / redis: 14400 Group membership and hierarchy data
.policies TtlConfig local: 30 / redis: 300 XACML/ABAC policy definitions (short local TTL)
.soar TtlConfig local: 900 / redis: 900 SOAR playbook and automated response data
.hcad TtlConfig local: 86400 / redis: 86400 HCAD behavioral baselines (long-lived profiles)

Each domain entry is a TtlConfig object with local-ttl-seconds and redis-ttl-seconds fields. Override any domain independently:

YAML
contexa:
  cache:
    type: HYBRID
    local:
      max-size: 5000
      default-ttl-seconds: 120
    redis:
      default-ttl-seconds: 600
      key-prefix: "myapp:contexa:cache:"
    pubsub:
      enabled: true
      channel: "contexa:cache:invalidation"
    domains:
      users:
        local-ttl-seconds: 1800
        redis-ttl-seconds: 3600
      policies:
        local-ttl-seconds: 15
        redis-ttl-seconds: 60
      hcad:
        local-ttl-seconds: 43200
        redis-ttl-seconds: 86400

Security Kafka Properties

Properties under security.kafka, bound to SecurityKafkaProperties. Configures Kafka topic names for Contexa's security event pipeline.

Property Type Default Description
security.kafka.topic (TopicSettings)
.authorizationStringsecurity-authorization-eventsAuthorization-decision event topic.
.authenticationStringauth-eventsAuthentication event topic.
.incidentStringsecurity-incident-eventsSecurity-incident event topic.
.threatStringthreat-indicatorsThreat-indicators topic.
.auditStringsecurity-audit-eventsAudit-event topic.
.generalStringsecurity-eventsGeneral security-event topic.
.dlqStringsecurity-events-dlqDead-letter queue topic for failed event processing.
.soar-actionStringsoar-action-eventsSOAR action event topic.
security.kafka.dlq (DlqSettings)
.max-retriesint3Maximum DLQ processing retries.
.retry-delay-msint5000Delay between retries in milliseconds.
.alert-thresholdint10Alerting threshold for the number of DLQ messages.
YAML
security:
  kafka:
    topic:
      authorization: security-authorization-events
      authentication: auth-events
      incident: security-incident-events
      threat: threat-indicators
      audit: security-audit-events
      general: security-events
      dlq: security-events-dlq
      soar-action: soar-action-events
    dlq:
      max-retries: 3
      retry-delay-ms: 5000
      alert-threshold: 10

Related: Zero Trust Security Reference | SOAR Automation Reference

OpenTelemetry Properties

Properties under contexa.opentelemetry, bound to OpenTelemetryProperties. Configures the OpenTelemetry integration for distributed tracing, metrics export, and observability.

Property Type Default Description
contexa.opentelemetry
.enabled boolean true Enable OpenTelemetry trace and metric export
.service-name String contexa-core Service name in trace spans and metric labels
.exporter-endpoint String http://localhost:4317 OTLP exporter endpoint (gRPC; 4318 for HTTP)
.sampling-probability double 1.0 Sampling probability (0.0–1.0); lower in production
YAML
contexa:
  opentelemetry:
    enabled: true
    service-name: "my-application"
    exporter-endpoint: "http://otel-collector.monitoring:4317"
    sampling-probability: 0.1

Security Redis Properties

Properties under security.redis, bound to SecurityRedisProperties. Configures Redis pub/sub channel names, Redis stream keys, TTL, and memory thresholds for Contexa's security events.

PropertyTypeDefaultDescription
security.redis.channel (ChannelSettings)
.authorizationStringsecurity:authorization:eventsAuthorization-event pub/sub channel.
.authenticationStringsecurity:eventsAuthentication-event pub/sub channel.
.incidentStringsecurity:incidentsIncident pub/sub channel.
.threatStringsecurity:threatsThreat pub/sub channel.
.auditStringsecurity:audit:eventsAudit pub/sub channel.
.generalStringsecurity:eventsGeneral pub/sub channel.
security.redis.stream (StreamSettings)
.authorizationStringsecurity:stream:authorizationAuthorization Redis stream key.
.incidentStringsecurity:stream:incidentIncident Redis stream key.
.threatStringsecurity:stream:threatThreat Redis stream key.
.auditStringsecurity:stream:auditAudit Redis stream key.
.generalStringsecurity:stream:generalGeneral Redis stream key.
.authenticationStringsecurity:stream:authenticationAuthentication Redis stream key.
.maxlenint10000Maximum entries per Redis stream (XADD MAXLEN).
security.redis.ttl (TtlSettings)
.minutesint60Default Redis TTL for event data (minutes).
security.redis.memory (MemorySettings)
.max-mbint1024Memory cap (MB) Contexa security events may consume in Redis.
.warning-thresholddouble0.8Warning threshold for memory usage (0.0-1.0).
.critical-thresholddouble0.9Critical threshold for memory usage (0.0-1.0).

Scheduler Lock Properties

Properties under contexa.scheduler.lock, bound to ContexaSchedulerLockProperties (record). Controls the ShedLock auto-configuration that ensures single execution of @Scheduled + @SchedulerLock methods across multiple JVMs. Single-instance deployments may keep the defaults — locks always succeed and the overhead is negligible.

PropertyTypeDefaultDescription
contexa.scheduler.lock
.enabledbooleantrueWhether the ShedLock auto-configuration registers a LockProvider bean. Setting this to false disables every @SchedulerLock; each @Scheduled method then reverts to single-JVM-only exclusivity.
.default-lock-at-most-forDuration5mFallback upper bound applied when a specific scheduler omits lockAtMostFor. Prevents stuck locks from surviving indefinitely after a JVM crash.
.use-database-timebooleantrueWhen true, the JdbcTemplateLockProvider uses now() from the database engine so every instance sees the same clock. When false, it falls back to the JVM clock (useful for local H2 tests with a misaligned timezone).

DataSource Properties

Properties under contexa.datasource, bound to ContexaDataSourceProperties. Defines the database connection Contexa uses for its own metadata (policies, users, audit log, etc.). Can be isolated from the host application's spring.datasource.

PropertyTypeDefaultDescription
contexa.datasource
.urlStringnullJDBC URL. When empty, the host application's spring.datasource.url may be reused depending on the isolation policy.
.usernameStringnullDatabase username.
.passwordStringnullDatabase password.
.driver-class-nameStringnullJDBC driver class name. When empty, derived from the URL automatically.
contexa.datasource.isolation (Isolation)
.allow-shared-application-datasourcebooleanfalseAllows reusing the host application's datasource. Default is isolation (separate connection pool).
.shared-application-datasource-risk-acceptedbooleanfalseOperator's explicit acknowledgment of the risk of using a shared datasource.
.contexa-owned-applicationbooleanfalseIndicates that the application itself is operated by Contexa (bypasses isolation validation).

Full Configuration Example

A production-ready application.yml combining all infrastructure properties for a distributed deployment with Redis, Kafka, and an external OpenTelemetry collector.

YAML
# Infrastructure configuration for Contexa distributed deployment
contexa:
  enabled: true
  infrastructure:
    mode: DISTRIBUTED
    redis:
      enabled: true
    kafka:
      enabled: true
    observability:
      enabled: true
      open-telemetry-enabled: true

  # Multi-tier caching
  cache:
    type: HYBRID
    local:
      max-size: 5000
      default-ttl-seconds: 120
    redis:
      default-ttl-seconds: 600
      key-prefix: "contexa:cache:"
    pubsub:
      enabled: true
      channel: "contexa:cache:invalidation"
    domains:
      users:
        local-ttl-seconds: 1800
        redis-ttl-seconds: 3600
      roles:
        local-ttl-seconds: 7200
        redis-ttl-seconds: 14400
      permissions:
        local-ttl-seconds: 14400
        redis-ttl-seconds: 28800
      groups:
        local-ttl-seconds: 7200
        redis-ttl-seconds: 14400
      policies:
        local-ttl-seconds: 15
        redis-ttl-seconds: 120
      soar:
        local-ttl-seconds: 900
        redis-ttl-seconds: 900
      hcad:
        local-ttl-seconds: 86400
        redis-ttl-seconds: 86400

  # OpenTelemetry
  opentelemetry:
    enabled: true
    service-name: "contexa-production"
    exporter-endpoint: "http://otel-collector.monitoring:4317"
    sampling-probability: 0.1

# Security event infrastructure - Kafka
security:
  kafka:
    topic:
      dlq: "security-events-dlq"