initialise

package
v1.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ObservationsImported = iota
	ObservationsImportedErr
)

Possible names of Kafka Producers

Variables

This section is empty.

Functions

This section is empty.

Types

type ExternalServiceList

type ExternalServiceList struct {
	Consumer                        bool
	ObservationsImportedProducer    bool
	ObservationsImportedErrProducer bool
	Graph                           bool
	ErrorReporter                   bool
	HealthCheck                     bool
	Init                            Initialiser
}

ExternalServiceList represents a list of services

func NewServiceList added in v1.6.0

func NewServiceList(initialiser Initialiser) ExternalServiceList

NewServiceList creates a new service list with the provided initialiser

func (*ExternalServiceList) GetConsumer

func (e *ExternalServiceList) GetConsumer(ctx context.Context, cfg *config.Config) (kafkaConsumer kafka.IConsumerGroup, err error)

GetConsumer returns a kafka consumer, which might not be initialised yet.

func (*ExternalServiceList) GetGraphDB

func (e *ExternalServiceList) GetGraphDB(ctx context.Context) (*graph.DB, error)

GetGraphDB returns a graphDB

func (*ExternalServiceList) GetHealthCheck

func (e *ExternalServiceList) GetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (healthcheck.HealthCheck, error)

GetHealthCheck creates a healthcheck with versionInfo

func (*ExternalServiceList) GetImportErrorReporter

func (e *ExternalServiceList) GetImportErrorReporter(observationsImportedErrProducer reporter.KafkaProducer, serviceName string) (errorReporter reporter.ImportErrorReporter, err error)

GetImportErrorReporter returns an ErrorImportReporter to send error reports to the import-reporter (only if ObservationsImportedErrProducer is available)

func (*ExternalServiceList) GetProducer

func (e *ExternalServiceList) GetProducer(ctx context.Context, kafkaBrokers []string, topic string, name KafkaProducerName, cfg *config.Config) (kafkaProducer kafka.IProducer, err error)

GetProducer returns a kafka producer, which might not be initialised yet.

type Init added in v1.6.0

type Init struct{}

Init implements the Initialiser interface to initialise dependencies

func (*Init) DoGetConsumer added in v1.6.0

func (i *Init) DoGetConsumer(ctx context.Context, topic, group string, kafkaConfig *config.KafkaConfig) (kafkaConsumer kafka.IConsumerGroup, err error)

func (*Init) DoGetGraphDB added in v1.6.0

func (i *Init) DoGetGraphDB(ctx context.Context) (*graph.DB, error)

func (*Init) DoGetHealthCheck added in v1.6.0

func (i *Init) DoGetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (healthcheck.HealthCheck, error)

func (*Init) DoGetImportErrorReporter added in v1.6.0

func (i *Init) DoGetImportErrorReporter(observationsImportedErrProducer reporter.KafkaProducer, serviceName string) (errorReporter reporter.ImportErrorReporter, err error)

func (*Init) DoGetProducer added in v1.6.0

func (i *Init) DoGetProducer(ctx context.Context, topic string, kafkaConfig *config.KafkaConfig) (kafkaProducer kafka.IProducer, err error)

type Initialiser added in v1.6.0

type Initialiser interface {
	DoGetConsumer(context.Context, string, string, *config.KafkaConfig) (kafka.IConsumerGroup, error)
	DoGetProducer(context.Context, string, *config.KafkaConfig) (kafka.IProducer, error)
	DoGetImportErrorReporter(reporter.KafkaProducer, string) (reporter.ImportErrorReporter, error)
	DoGetHealthCheck(*config.Config, string, string, string) (healthcheck.HealthCheck, error)
	DoGetGraphDB(context.Context) (*graph.DB, error)
}

type KafkaProducerName

type KafkaProducerName int

KafkaProducerName : Type for kafka producer name used by iota constants

func (KafkaProducerName) String

func (k KafkaProducerName) String() string

Values of the kafka producers names

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL