Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GetCantabularClient = func(cfg *config.Config) CantabularClient { return cantabular.NewClient( cantabular.Config{ Host: cfg.CantabularURL, ExtApiHost: cfg.CantabularExtURL, }, dphttp.NewClient(), nil, ) }
View Source
var GetDatasetAPIClient = func(cfg *config.Config) DatasetAPIClient { return dataset.NewAPIClient(cfg.DatasetAPIURL) }
View Source
var GetHTTPServer = func(bindAddr string, router http.Handler) HTTPServer { s := dphttp.NewServer(bindAddr, router) s.HandleOSSignals = false return s }
GetHTTPServer returns an http server
View Source
var GetHealthCheck = func(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error) { versionInfo, err := healthcheck.NewVersionInfo(buildTime, gitCommit, version) if err != nil { return nil, err } hc := healthcheck.New(versionInfo, cfg.HealthCheckCriticalTimeout, cfg.HealthCheckInterval) return &hc, nil }
GetHealthCheck returns a healthcheck
View Source
var GetImportAPIClient = func(cfg *config.Config) ImportAPIClient { return importapi.New(cfg.ImportAPIURL) }
View Source
var GetKafkaConsumer = func(ctx context.Context, cfg *config.Config) (kafka.IConsumerGroup, error) { kafkaOffset := kafka.OffsetNewest if cfg.KafkaConfig.OffsetOldest { kafkaOffset = kafka.OffsetOldest } cgConfig := &kafka.ConsumerGroupConfig{ BrokerAddrs: cfg.KafkaConfig.Addr, Topic: cfg.KafkaConfig.InstanceStartedTopic, GroupName: cfg.KafkaConfig.InstanceStartedGroup, MinBrokersHealthy: &cfg.KafkaConfig.ConsumerMinBrokersHealthy, KafkaVersion: &cfg.KafkaConfig.Version, NumWorkers: &cfg.KafkaConfig.NumWorkers, Offset: &kafkaOffset, } if cfg.KafkaConfig.SecProtocol == config.KafkaTLSProtocolFlag { cgConfig.SecurityConfig = kafka.GetSecurityConfig( cfg.KafkaConfig.SecCACerts, cfg.KafkaConfig.SecClientCert, cfg.KafkaConfig.SecClientKey, cfg.KafkaConfig.SecSkipVerify, ) } return kafka.NewConsumerGroup(ctx, cgConfig) }
GetKafkaConsumer returns a Kafka consumer with the provided config
View Source
var GetKafkaProducer = func(ctx context.Context, cfg *config.Config) (kafka.IProducer, error) { pConfig := &kafka.ProducerConfig{ BrokerAddrs: cfg.KafkaConfig.Addr, Topic: cfg.KafkaConfig.CategoryDimensionImportTopic, MinBrokersHealthy: &cfg.KafkaConfig.ProducerMinBrokersHealthy, KafkaVersion: &cfg.KafkaConfig.Version, MaxMessageBytes: &cfg.KafkaConfig.MaxBytes, } if cfg.KafkaConfig.SecProtocol == config.KafkaTLSProtocolFlag { pConfig.SecurityConfig = kafka.GetSecurityConfig( cfg.KafkaConfig.SecCACerts, cfg.KafkaConfig.SecClientCert, cfg.KafkaConfig.SecClientKey, cfg.KafkaConfig.SecSkipVerify, ) } return kafka.NewProducer(ctx, pConfig) }
GetKafkaProducer returns a kafka producer with the provided config
View Source
var GetRecipeAPIClient = func(cfg *config.Config) RecipeAPIClient { return recipe.NewClient(cfg.RecipeAPIURL) }
Functions ¶
This section is empty.
Types ¶
type CantabularClient ¶ added in v0.3.0
type CantabularClient interface { GetDimensionsByName(ctx context.Context, req cantabular.GetDimensionsByNameRequest) (*cantabular.GetDimensionsResponse, error) Checker(context.Context, *healthcheck.CheckState) error CheckerAPIExt(ctx context.Context, state *healthcheck.CheckState) error }
type DatasetAPIClient ¶ added in v0.3.0
type HTTPServer ¶
HTTPServer defines the required methods from the HTTP server
type HealthChecker ¶
type HealthChecker interface { Handler(w http.ResponseWriter, req *http.Request) Start(ctx context.Context) Stop() AddAndGetCheck(name string, checker healthcheck.Checker) (check *healthcheck.Check, err error) Subscribe(s healthcheck.Subscriber, checks ...*healthcheck.Check) }
HealthChecker defines the required methods from Healthcheck
type ImportAPIClient ¶ added in v0.5.0
type RecipeAPIClient ¶ added in v0.3.0
type Service ¶
type Service struct { Cfg *config.Config Server HTTPServer HealthCheck HealthChecker Consumer kafka.IConsumerGroup Producer kafka.IProducer // contains filtered or unexported fields }
Service contains all the configs, server and clients to run the event handler service
Click to show internal directories.
Click to hide internal directories.