예제 #1
0
func main() {
	broker_endpoint := os.Args[1]
	service := os.Args[2]
	w := mdp.NewJSONRPCWorker(broker_endpoint, service)
	w.Register(NewMouse())
	w.Run()

	//err = zj.Loop()
	//fmt.Printf("Loop: %s\n", err)
}
예제 #2
0
func main() {
	var settings Settings
	workers.ParseArgs(&settings)
	// Load the client cert
	cert, err := czmq.NewCertFromFile(settings.ClientCertificatePath)
	if err != nil {
		log.Error(err.Error())
		os.Exit(1)
	}

	// Load the server cert
	server_cert, err := czmq.NewCertFromFile(settings.BrokerKeyPath)
	if err != nil {
		log.Error(err.Error())
		os.Exit(1)
	}

	log.WithFields(log.Fields{"broker": settings.Broker, "service": service}).Info("Worker starting up")
	worker := mdp.NewJSONRPCWorker(settings.Broker, service)
	worker.CurveServerPublicKey = server_cert.PublicText()
	worker.CurveCertificate = cert
	worker.Register(&Pushover{client: settings.ClientKey, user: settings.UserKey})
	worker.Run()
}