msa

package module
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 11 Imported by: 0

README

msa

Go microservice architecture main component, responsible for application startup, 
dependency injection,configuration reading, life cycle management.

go dip tools

https://github.com/go-god/gdi

providers

You can pass the provider into the msa.Start method as an Option through the 
msa.WithProviders or msa.WithConfigProviders method to start the service.

Documentation

Index

Constants

This section is empty.

Variables

InterruptSignals interrupt signals.

Functions

func IsSet added in v1.3.2

func IsSet(key string) bool

IsSet check configInterface is set key

func LoadConf added in v1.3.2

func LoadConf(key string, obj interface{}) error

LoadConf get key from configInterface,obj must be a pointer

func Start

func Start(opts ...Option)

Start create an engine and run application.

func Stop added in v1.2.0

func Stop()

Stop if receive active exit signal,the application will exit

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine application engine

func New

func New(opts ...Option) *Engine

New create an application for msa engine

func (*Engine) IsSet added in v1.3.2

func (e *Engine) IsSet(key string) bool

IsSet configInterface is set key

func (*Engine) LoadConf added in v1.3.2

func (e *Engine) LoadConf(key string, obj interface{}) error

LoadConf get key from configInterface,obj must be a pointer

func (*Engine) Start

func (e *Engine) Start()

Start run app

func (*Engine) Stop added in v1.2.0

func (e *Engine) Stop()

Stop if receive active exit signal,the application will exit

type Option

type Option func(e *Engine)

Option engine option

func WithConfigInterface

func WithConfigInterface(c config.ConfigInterface) Option

WithConfigInterface set config read interface

func WithConfigProvider added in v1.3.0

func WithConfigProvider(configProvider provides.ConfigProvider) Option

WithConfigProvider add config providers

func WithGracefulWait

func WithGracefulWait(t time.Duration) Option

WithGracefulWait set engine gracefulWait.

func WithInjectValues

func WithInjectValues(objects ...*gdi.Object) Option

WithInjectValues set inject object

func WithInjector

func WithInjector(injectType factory.InjectType) Option

WithInjector set injector inject type as: factory.FbInject or factory.DigInject

func WithInterruptSignals

func WithInterruptSignals(signals ...os.Signal) Option

WithInterruptSignals set engine interruptSignals

func WithLogger

func WithLogger(opts ...logger.Option) Option

WithLogger logger config

func WithProviders

func WithProviders(provides ...provides.Provider) Option

WithProviders add providers

Directories

Path Synopsis
Package logger for log interface
Package logger for log interface

Jump to

Keyboard shortcuts

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