Skip to content

Appsettings

synthaicode edited this page Oct 25, 2025 · 10 revisions

Appsettings

This page explains how Ksql.Linq reads configuration and which keys are commonly used.

Sources and precedence (override order)

Ksql.Linq uses the standard .NET configuration stack. Later sources override earlier ones:

  • Code (builder / Fluent APIs)
  • Environment variables (DOTNET_... / KsqlDsl__... etc.)
  • appsettings.{Environment}.json
  • appsettings.json
  • Library defaults

Note: The typical .NET pattern is AddJsonFile → AddEnvironmentVariables → AddCommandLine; the last wins. KsqlContextBuilder respects the resolved IConfiguration you pass in.

Minimal configuration

{
  "KsqlDsl": {
    "Common": { "BootstrapServers": "localhost:9092", "ClientId": "my-app" },
    "SchemaRegistry": { "Url": "http://localhost:8081" },
    "KsqlDbUrl": "http://localhost:8088",
    "DlqTopicName": "dead-letter-queue",
    "DeserializationErrorPolicy": "DLQ"
  }
}

Key sections

  • KsqlDsl.Common.*: base Kafka Producer/Consumer options (e.g., BootstrapServers)
  • KsqlDsl.SchemaRegistry.Url: Schema Registry URL
  • KsqlDsl.KsqlDbUrl: ksqlDB REST URL
  • KsqlDsl.DlqTopicName, KsqlDsl.DeserializationErrorPolicy: DLQ settings
  • KsqlDsl.Topics.<name>.Creation.*: topic creation (partitions/replication/retention, etc.)
  • KsqlDsl.Topics.<name>.Consumer|Producer.*: per-topic consumer/producer options

Secured Kafka (SASL_SSL) example

{
  "KsqlDsl": {
    "Common": {
      "BootstrapServers": "<broker1>:9092,<broker2>:9092",
      "SecurityProtocol": "SaslSsl",
      "SaslMechanism": "Plain",
      "SaslUsername": "${CLOUD_API_KEY}",
      "SaslPassword": "${CLOUD_API_SECRET}"
    },
    "SchemaRegistry": { "Url": "https://<sr-host>:8081" },
    "KsqlDbUrl": "https://<ksqldb-host>:8088"
  }
}

Table/TimeBucket state store (RocksDB)

For how local state is used and maintained, see: Tumbling-State-Store

See also

Clone this wiki locally