Exemple #1
0
// NewSerfSubsys initializes and return a SerfSubsys instance
func NewSerfSubsys(config *client.Config) *SerfSubsys {
	//XXX: make a copy of the config as the serf client changes the config
	c := *config
	sm := &SerfSubsys{
		config: &c,
		router: serfer.NewRouter(),
	}
	return sm
}
Exemple #2
0
func main() {
	r := serfer.NewRouter()
	r.AddMemberJoinHandler(handleJoin)
	sr := r.NewSubRouter("events/")
	sr.AddHandler("foo", handleFoo)

	if err := r.InitSerfAndServe(""); err != nil {
		log.Fatalf("Failed to initialize serfer. Error: %s", err)
	}
}