nebula

package module
v1.18.3 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

README

nebula

Version

go版本:go 1.13 micro版本:micro 自建镜像1.17.2
nebula版本:nebula tag版本 v1.17.9

Install

go get github.com/Wall-js/nebula
export GOPROXY=https://goproxy.cn,direct golang替换国源

go env -w GOPROXY=https://goproxy.cn,direct
go env -w GOPRIVATE=*.hiqio.com,*.gitlab.com,*.gitee.com //跳过私有库

Demo

服务配置规范

####节点命名

/集群名/命名空间/类型(srv,api,web,evt)/系统/版本(/id)(括号部分可不使用)

/default/nebula/srv/nebula-core/v0.1(/nebula.core.srv)

/cluster/namespace/type/system/version(/appId)
Type

页面web,接口api,服务srv,事件evt

Starting
func main() {
	nebula.SetName("nebula.core.srv")
	hello.RegisterHelloHandler(nebula.Service.Server(), new(handler.Hello))
	micro.RegisterSubscriber("nebula.core.srv.hello", nebula.Service.Server(), new(subscriber.Hello))
	micro.RegisterSubscriber("nebula.core.srv.hello", nebula.Service.Server(), subscriber.Handler)
	nebula.Run()
}
Config
    version := nebula.Conf.Get("version").String("unknown")
    name := nebula.Conf.Get("config","name").String("unknown")
Web
func main() {
	nebula.SetName("go.micro.api.greeter")
	router := gin.New()
	say := new(Say)
	router.GET("/greeter", say.Anything)
	// Register Handler
	nebula.Web.Handle("/", router)
	nebula.RunWeb()
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RabbitBroker = rabbitmq.NewBroker()
	NatsBroker   = nats.NewBroker()
	NsqBroker    = nsq.NewBroker()
)
View Source
var (
	Version = "v1.17.5"
	Conf    = config.NewConfig()
	Service = micro.NewService()
	Web     = web.NewService()
)

Functions

func InitNatsBroker

func InitNatsBroker(b broker.Broker, options ...broker.Option)

func InitNsqBroker

func InitNsqBroker(b broker.Broker, options ...broker.Option)

func InitProcess added in v1.17.5

func InitProcess()

func InitRabbitBroker

func InitRabbitBroker(b broker.Broker, options ...broker.Option)

func NewNatsBroker

func NewNatsBroker(opts ...broker.Option) broker.Broker

func NewNsqBroker

func NewNsqBroker(opts ...broker.Option) broker.Broker

func NewRabbitBroker

func NewRabbitBroker(opts ...broker.Option) broker.Broker

func NewService

func NewService() micro.Service

func Publish

func Publish(b broker.Broker, topic string, data []byte, opts ...broker.PublishOption) string

func Run

func Run()

func RunProcess added in v1.17.5

func RunProcess(process func(context.Context, context.CancelFunc) error)

func RunWeb added in v1.17.4

func RunWeb()

func SetName added in v1.17.4

func SetName(name string)

func Subscribe

func Subscribe(b broker.Broker, topic string, handle func(broker.Event) error, opts ...broker.SubscribeOption)

Types

type Option added in v1.17.5

type Option func(*Options)

type Options added in v1.17.5

type Options struct {
	Version string
	Conf    config.Config
	Service micro.Service
	Web     web.Service
	// contains filtered or unexported fields
}

Directories

Path Synopsis
web
v2

Jump to

Keyboard shortcuts

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