func main() { log = logrus.New() log.Info("Starting tickRecorder service...") service := micro.NewService(getOptions) service.Run() }
func srv(ctx *cli.Context) { service := micro.NewService( micro.Name("go.micro.srv.trace"), micro.RegisterTTL( time.Duration(ctx.GlobalInt("register_ttl"))*time.Second, ), micro.RegisterInterval( time.Duration(ctx.GlobalInt("register_interval"))*time.Second, ), ) if len(ctx.GlobalString("database_url")) > 0 { mysql.Url = ctx.GlobalString("database_url") } proto.RegisterTraceHandler(service.Server(), new(handler.Trace)) service.Server().Subscribe( service.Server().NewSubscriber(trace.TraceTopic, trace.ProcessSpan), ) if err := db.Init(); err != nil { log.Fatal(err) } if err := service.Run(); err != nil { log.Fatal(err) } }
func main() { cmd.Init() log = logrus.New() service = micro.NewService( micro.Flags(cli.StringFlag{ Name: "pair", Value: "USD", Usage: "Select pair to subscribe", EnvVar: "PAIR", }), micro.Flags(cli.StringFlag{ Name: "currency", Value: "JPY", Usage: "Select pair to subscribe", EnvVar: "CURRENCY", }), micro.Action(func(c *cli.Context) { settings.pair = c.String("pair") settings.currency = c.String("currency") }), micro.Name("PairSubscriber"), ) service.Init(getOptions) go exec(settings.pair, settings.currency) select {} }