app

package
v0.0.0-...-031a617 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigProvider provides configuration related dependencies.
	ConfigProvider = fx.Options(
		fx.Provide(func(cfg infra.Config) infra.ServerConfig {
			return cfg.Server
		}),
		fx.Provide(func(cfg infra.Config) infra.DBConfig {
			return cfg.DB
		}),
		fx.Provide(func(cfg infra.Config) infra.RedisConfig {
			return cfg.Redis
		}),
		fx.Provide(func(cfg infra.Config) infra.KafkaConfig {
			return cfg.Kafka
		}),
	)

	// InfraProvider provides infrastructure related dependencies.
	InfraProvider = fx.Options(
		ConfigProvider,
		fx.Provide(infra.NewSqlx),
		fx.Provide(infra.NewRedisClient),
		fx.Provide(infra.NewKafkaProducer),
	)

	// RepoProvider provides repository related dependencies.
	RepoProvider = fx.Options(
		InfraProvider,
		fx.Provide(cachedao.NewCacheDao),
		fx.Provide(dbdao.NewDBDRepository),
		fx.Provide(redisdao.NewRedisRepository),
	)

	// GrpcAPI provides gRPC API related dependencies.
	GrpcAPI = fx.Options(
		RepoProvider,
		fx.Provide(grpcapi.NewGrpcApi),
	)

	// EventProcessor provides event processing related dependencies.
	EventProcessor = fx.Options(
		RepoProvider,
		fx.Provide(processor.NewEventProcessor),
	)
)

Functions

func NewConsumerAPP

func NewConsumerAPP(cfgName string) *fx.App

NewConsumerAPP creates a new fx.App for the consumer application.

func NewGrpcApiAPP

func NewGrpcApiAPP(cfgName string, opts ...fx.Option) *fx.App

NewGrpcApiAPP creates a new fx.App for the gRPC API application.

func RunConsumer

func RunConsumer(lc fx.Lifecycle, consumerBuilder *kafka.ConfluentConsumerBuilder, eventProcessor *processor.EventProcessor) error

RunConsumer sets up and runs the consumer within the fx lifecycle.

func RunGrpcServer

func RunGrpcServer(lc fx.Lifecycle, config infra.ServerConfig, grpcApi grpcapi.GrpcApi) error

RunGrpcServer run a new gRPC server

func RunLivenessProbe

func RunLivenessProbe(lc fx.Lifecycle, eventProcessor *processor.EventProcessor) error

RunLivenessProbe starts an HTTP server to handle liveness and readiness probes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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