Ejemplo n.º 1
0
func main() {
	flag.Parse()

	config, err := tools.ReadConfig()
	if err != nil {
		log.Fatal(err)
	}

	dbSpec, err := config.GetString("server", "db")
	if err != nil {
		log.Fatal(err)
	}

	var gs grserver
	gs.db, err = tools.CreateDb(dbSpec)
	if err != nil {
		log.Fatal(err)
	}

	pserver := printserver.Server{
		Source:      "/amq/queue/contester.printrequests",
		Destination: "/amq/queue/source_pb",
	}

	pserver.StompConfig, err = tools.ParseStompFlagOrConfig("", config, "messaging")
	if err != nil {
		log.Fatalf("Opening stomp connection: %s", err)
		return
	}

	for {
		log.Println(pserver.Process(gs.processIncoming))
		time.Sleep(15 * time.Second)
	}
}
Ejemplo n.º 2
0
func main() {
	flag.Parse()

	config, err := tools.ReadConfig()
	if err != nil {
		log.Fatal(err)
	}

	pserver := printserver.Server{
		Source: "/amq/queue/printer",
	}

	pserver.StompConfig, err = tools.ParseStompFlagOrConfig("", config, "messaging")
	if err != nil {
		log.Fatal(err)
	}

	var srv server
	srv.Gsprint = "gsprint.exe"
	srv.Workdir, err = config.GetString("workdirs", "printer")
	if err != nil {
		log.Fatal(err)
	}

	for {
		pserver.Process(srv.processIncoming)
		time.Sleep(15 * time.Second)
	}
}
Ejemplo n.º 3
0
func main() {
	flag.Parse()

	config, err := tools.ReadConfig()
	if err != nil {
		log.Fatal(err)
	}

	pserver := printserver.Server{
		Source:      "/amq/queue/tex_processor",
		Destination: "/amq/queue/printer",
	}

	pserver.StompConfig, err = tools.ParseStompFlagOrConfig("", config, "messaging")
	if err != nil {
		log.Fatal(err)
	}

	var sserver server
	if sserver.Workdir, err = config.GetString("workdirs", "tex_processor"); err != nil {
		log.Fatal(err)
	}

	os.MkdirAll(sserver.Workdir, os.ModePerm)

	for {
		pserver.Process(sserver.processIncoming)
		time.Sleep(15 * time.Second)
	}
}
Ejemplo n.º 4
0
func main() {
	flag.Parse()

	config, err := tools.ReadConfig()
	if err != nil {
		log.Fatal(err)
	}

	pserver := printserver.Server{
		Source:      "/amq/queue/ticket_pb",
		Destination: "/amq/queue/tex_processor",
	}

	pserver.StompConfig, err = tools.ParseStompFlagOrConfig("", config, "messaging")
	if err != nil {
		log.Fatal(err)
	}

	log.Println(pserver)

	for {
		log.Println(pserver.Process(processIncoming))
		time.Sleep(15 * time.Second)
	}
}
Ejemplo n.º 5
0
func main() {
	flag.Parse()

	config, err := tools.ReadConfig()
	if err != nil {
		log.Fatal(err)
	}

	pserver := printserver.Server{
		Source:      "/amq/queue/source_pb",
		Destination: "/amq/queue/tex_processor",
	}

	pserver.StompConfig, err = tools.ParseStompFlagOrConfig("", config, "messaging")
	if err != nil {
		log.Fatal(err)
	}

	languageNames, err := config.GetOptions("languages")
	if err != nil {
		log.Fatal(err)
	}

	sserver := server{
		languages: make(map[string]string),
	}

	if sserver.Workdir, err = config.GetString("workdirs", "source_processor"); err != nil {
		log.Fatal(err)
	}

	os.MkdirAll(sserver.Workdir, os.ModePerm)

	for _, lang := range languageNames {
		v, err := config.GetString("languages", lang)
		if err != nil {
			log.Fatal(err)
		}
		for _, v := range strings.Split(v, " ") {
			sserver.languages[v] = lang
		}
	}

	for {
		pserver.Process(sserver.processIncoming)
		time.Sleep(15 * time.Second)
	}
}