booblik

BooblikConfig

Generated page

Model gemma-mtp, commit ef58254ca7be, 2026-08-16, sources: 6. Edit the code or the hand-written documentation instead.

Diagram

BooblikConfig

The data class representing the validated broker configuration, including topic partitioning and retention policies. It encapsulates all settings required for the broker to initialize, such as the data directory, port, and transport settings BooblikConfig.kt:32-48.

Configuration Precedence

The hierarchy of settings where environment variables override properties files, which in turn override defaults. The raw function implements this logic by checking the environment first, then the properties, and finally falling back to a default or erroring out BooblikConfig.kt:90-91.

The mapping for environment variables follows a specific convention:

KeyEnvironment Variable
booblik.portBOOBLIK_PORT
booblik.data.dirBOOBLIK_DATA_DIR
booblik.topicsBOOBLIK_TOPICS

Topic Parsing

The mechanics of parsing the booblik.topics string into a map of TopicName to partition counts. The parseTopics function splits the input string by commas and then by colons to extract the name and the number of partitions BooblikConfig.kt:144-154.

The expected format is:

FormatExample
name:partitionsorders:3,clicks:1

Startup Validation

The init block requirements and error handling for invalid ports, empty topics, or non-positive capacity/interval values. The configuration is strictly validated during construction to ensure that a typo results in a refusal to boot rather than a runtime surprise BooblikConfig.kt:49-55.

The following constraints are enforced:

ParameterRequirement
portMust be in range 0..65535
topicsMust not be empty
segmentCapacityMust be greater than 0
indexIntervalBytesMust be greater than 0
retentionCheckMillisMust be greater than 0

BooblikConfigTest

Verification of default values, environment overrides, and the refusal to boot on nonsense values or missing files. The test suite ensures that the broker fails fast when provided with invalid configuration, such as non-integer ports or invalid segment modes BooblikConfigTest.kt:63-79.

Key files

FileLinesWhat is there
…/app/BooblikConfig.kt32-48The BooblikConfig data class definition and its properties.
…/app/BooblikConfig.kt68-141The companion object containing the load logic and parsing helpers.
…/app/BooblikConfigTest.kt34-80Unit tests for defaults, precedence, and validation logic.

Behaviour that surprises

  • The load function in BooblikConfig.kt:76-141 will throw an IllegalArgumentException if a configuration file is explicitly provided but does not exist on the filesystem BooblikConfig.kt:82-85.
  • The parseTopics function in BooblikConfig.kt:144-154 requires that every topic entry contains exactly one colon separating the name and the partition count BooblikConfig.kt:149-150.

On this page