github.com/godevsig/adaptiveservice@v0.9.23/examples/hello/server/helloserver.go (about) 1 package main 2 3 import ( 4 "fmt" 5 6 as "github.com/godevsig/adaptiveservice" 7 msg "github.com/godevsig/adaptiveservice/examples/hello/message" 8 ) 9 10 func main() { 11 s := as.NewServer().SetPublisher("example") 12 13 knownMsgs := []as.KnownMessage{msg.HelloRequest{}} 14 if err := s.Publish("hello", knownMsgs); err != nil { 15 fmt.Println(err) 16 return 17 } 18 19 if err := s.Serve(); err != nil { // ctrl+c to exit 20 fmt.Println(err) 21 } 22 }