func main() { // optionally setup command line usage cmd.Init() host, err := os.Hostname() if err != nil { log.Fatalf("Unable to obtain hostname: %s", err) } // Initialise Server server.Init( server.Name("io.jbrodriguez.mediagui.agent."+host), server.Address("0.0.0.0:0"), ) // Register Handlers server.Handle( server.NewHandler( &Agent{host: host}, ), ) log.Info("Agent started ") // Run server if err := server.Run(); err != nil { log.Info(err) } }
func main() { // optionally setup command line usage cmd.Init() // Initialise Server server.Init( server.Name("go.micro.api.geo"), ) // Register Handlers server.Handle( server.NewHandler(new(handler.Location)), ) // Run server if err := server.Run(); err != nil { log.Fatal(err) } }
func main() { // optionally setup command line usage cmd.Init() // Initialise Server server.Init( server.Name("go.micro.srv.example"), ) // Register Handlers server.Handle( server.NewHandler( new(handler.Example), ), ) // Register Subscribers server.Subscribe( server.NewSubscriber( "topic.go.micro.srv.example", new(subscriber.Example), ), ) server.Subscribe( server.NewSubscriber( "topic.go.micro.srv.example", subscriber.Handler, ), ) // Run server if err := server.Run(); err != nil { log.Fatal(err) } }