예제 #1
0
파일: main.go 프로젝트: yanatan16/protorpc
func main() {
	f := flag.Int("fp", 12001, "Front End port number")
	b := flag.Int("bp", 12002, "Back End port number")
	flag.Parse()

	front := fmt.Sprintf("*:%d", *f)
	back := fmt.Sprintf("*:%d", *b)

	broker, err := protorpc.NewBroker(front, back)
	if err != nil {
		log.Fatal("Error creating broker:", err)
	}

	log.Printf("Serving protorpc broker with frontend :%d and backend :%d", *f, *b)
	broker.Serve()
}
예제 #2
0
func StartBrokeredRPC() {
	broker_front = GetAddr()
	broker_back := GetAddr()
	broker, err := protorpc.NewBroker(broker_front, broker_back)
	if err != nil {
		log.Fatal("Error creating broker:", err)
	}
	go func() {
		broker.Serve()
	}()
	servers = append(servers, broker)
	<-time.After(50 * time.Millisecond)

	svr, err := protorpc.Serve(broker_back, true)
	if err != nil {
		log.Fatal("cant setup calc service:", err)
	}
	servers = append(servers, svr)
}