AsConfigMap (kafka/config.go)

openmeter · pkg/kafka/config.go · go · Apache-2.0
infra

Builds and validates Kafka configuration maps for producers and consumers.

// Source: https://github.com/openmeterio/openmeter | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package kafka

import (
	"encoding"
	"encoding/json"
	"errors"
	"fmt"
	"slices"
	"strconv"
	"strings"
	"time"

	"github.com/confluentinc/confluent-kafka-go/v2/kafka"
	"github.com/samber/lo"
)

type ConfigValidator interface {
	Validate() error
}

type ConfigMapper interface {
	AsConfigMap() (kafka.ConfigMap, error)
}

var (
	_ ConfigMapper    = (*CommonConfigParams)(nil)
	_ ConfigValidator = (*CommonConfigParams)(nil)
)

type CommonConfigParams struct {
	Brokers          string
	SecurityProtocol string
	SaslMechanisms   string
	SaslUsername     string
	SaslPassword     string

	Stat

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key