Skip to content
GitHub

Configuration

Configuration is loaded from the events: section of application.yaml and injected into EventsProvider via config_key = "events".

All keys can be overridden with environment variables using the prefix LEX_EVENTS__:

Terminal window
LEX_EVENTS__NAME=prod-events \
LEX_EVENTS__EVENT_STORE_BACKEND=postgres \
LEX_EVENTS__ENABLED=true

Config section key: events

KeyTypeDefaultEnv VarDescription
namestr"events"LEX_EVENTS__NAMEInstance name
enabledboolTrueLEX_EVENTS__ENABLEDEnable events system
event_store_backendEventStoreBackend"memory"LEX_EVENTS__EVENT_STORE_BACKENDBackend: memory, postgres, mongodb, sqlite
debugboolFalseLEX_EVENTS__DEBUGEnable debug mode
envstr | NoneNoneLEX_EVENTS__ENVRuntime environment
postgresPostgresEventStoreConfig | NoneNoneLEX_EVENTS__POSTGRES__*Postgres store config
mongodbMongoDBEventStoreConfig | NoneNoneLEX_EVENTS__MONGODB__*MongoDB store config
memoryInMemoryEventStoreConfigdefaultsLEX_EVENTS__MEMORY__*In-memory store config
sqliteSqliteConfig | NoneNoneLEX_EVENTS__SQLITE__*SQLite store config
snapshotsSnapshotConfigdefaultsLEX_EVENTS__SNAPSHOTS__*Snapshot config
command_busCommandBusConfigdefaultsLEX_EVENTS__COMMAND_BUS__*Command bus config
query_busQueryBusConfigdefaultsLEX_EVENTS__QUERY_BUS__*Query bus config
event_busEventBusConfigdefaultsLEX_EVENTS__EVENT_BUS__*Event bus config
sagaSagaConfigdefaultsLEX_EVENTS__SAGA__*Saga config
projectionProjectionConfigdefaultsLEX_EVENTS__PROJECTION__*Projection config
streamingStreamingConfigdefaultsLEX_EVENTS__STREAMING__*Streaming config
logging_middlewareLoggingMiddlewareConfigdefaultsLEX_EVENTS__LOGGING_MIDDLEWARE__*Logging middleware
validation_middlewareValidationMiddlewareConfigdefaultsLEX_EVENTS__VALIDATION_MIDDLEWARE__*Validation middleware
transaction_middlewareTransactionMiddlewareConfigdefaultsLEX_EVENTS__TRANSACTION_MIDDLEWARE__*Transaction middleware
retry_middlewareRetryMiddlewareConfigdefaultsLEX_EVENTS__RETRY_MIDDLEWARE__*Retry middleware
metrics_middlewareMetricsMiddlewareConfigdefaultsLEX_EVENTS__METRICS_MIDDLEWARE__*Metrics middleware
rabbitmqRabbitMQConfig | NoneNoneLEX_EVENTS__RABBITMQ__*RabbitMQ adapter config
kafkaKafkaConfig | NoneNoneLEX_EVENTS__KAFKA__*Kafka adapter config
KeyTypeDefaultDescription
max_retriesint3Max command retry attempts
retry_delay_secondsfloat1.0Delay between retries
timeout_secondsfloat30.0Command execution timeout
enable_validationboolTrueEnable command validation
enable_loggingboolTrueEnable command logging
enable_metricsboolTrueEnable command metrics
KeyTypeDefaultDescription
max_concurrent_handlersint10Max concurrent event handlers
handler_timeout_secondsfloat30.0Per-handler timeout
retry_failed_handlersboolTrueRetry on handler failure
max_handler_retriesint3Max retries per handler
enable_dead_letterboolTrueEnable dead-letter queue
allow_no_handlersboolTrueAllow events with no handlers
parallel_dispatchboolTrueDispatch to handlers in parallel
continue_on_errorboolTrueContinue on handler error
max_queue_per_subscriberint1000Max queued events per subscriber
KeyTypeDefaultDescription
enabledboolTrueEnable aggregate snapshots
strategySnapshotStrategy"event_count"Strategy: event_count, time_based, on_demand
event_count_thresholdint100Events between snapshots
time_threshold_secondsint3600Seconds between time-based snapshots
max_snapshots_per_aggregateint5Max stored snapshots
events:
event_store_backend: memory
command_bus:
max_retries: 3
timeout_seconds: 30
event_bus:
parallel_dispatch: true
continue_on_error: true
events:
event_store_backend: postgres
postgres:
dsn: "postgresql://user:pass@localhost:5432/events"
schema: "events"
snapshots:
enabled: true
strategy: event_count
event_count_threshold: 50
command_bus:
max_retries: 3
timeout_seconds: 60
event_bus:
parallel_dispatch: true
continue_on_error: false
enable_dead_letter: true
Terminal window
LEX_EVENTS__EVENT_STORE_BACKEND=postgres \
LEX_EVENTS__POSTGRES__DSN=postgresql://user:pass@localhost:5432/events \
LEX_EVENTS__SNAPSHOTS__ENABLED=true \
LEX_EVENTS__SNAPSHOTS__EVENT_COUNT_THRESHOLD=50 \
LEX_EVENTS__COMMAND_BUS__MAX_RETRIES=3 \
LEX_EVENTS__COMMAND_BUS__TIMEOUT_SECONDS=60 \
LEX_EVENTS__EVENT_BUS__PARALLEL_DISPATCH=true \
LEX_EVENTS__EVENT_BUS__CONTINUE_ON_ERROR=false \
LEX_EVENTS__EVENT_BUS__ENABLE_DEAD_LETTER=true