nebula

package module
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

README

nebula

Install

go get github.com/Wall-js/nebula export GOPROXY=https://goproxy.io

Demo

服务配置规范

####节点命名

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

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

/cluster/namespace/type/system/version(/appId)
Type
web,api,srv,evt
Starting
	nebula.Service.Init(
		micro.Name("nebula.core.srv.hello"),
	)
	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")
Web
func main() {
	nebula.Web.Init(
		web.Name("nebula.core.greeter"),
	)

	router := gin.New()
	say := new(Say)
	router.GET("/greeter", say.Anything)

	// Register Handler
	nebula.Web.Handle("/", router)
	nebula.RunWeb()
}

micro api --handler=http

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RabbitBroker = rabbitmq.NewBroker()
	NatsBroker   = nats.NewBroker()
	NsqBroker    = nsq.NewBroker()
)
View Source
var (
	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 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 Subscribe

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

Types

This section is empty.

Directories

Path Synopsis
web

Jump to

Keyboard shortcuts

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