func main() { app := &EchoApplication{} app.log = log.New(ioutil.Discard, "", log.LstdFlags) //app.log = log.New(os.Stdout, "", log.LstdFlags) router.AddRoute(fix40nos.Route(app.OnFIX40NewOrderSingle)) router.AddRoute(fix41nos.Route(app.OnFIX41NewOrderSingle)) router.AddRoute(fix42nos.Route(app.OnFIX42NewOrderSingle)) router.AddRoute(fix43nos.Route(app.OnFIX43NewOrderSingle)) router.AddRoute(fix44nos.Route(app.OnFIX44NewOrderSingle)) router.AddRoute(fix50nos.Route(app.OnFIX50NewOrderSingle)) router.AddRoute(fix50sp1nos.Route(app.OnFIX50SP1NewOrderSingle)) router.AddRoute(fix50sp2nos.Route(app.OnFIX50SP2NewOrderSingle)) router.AddRoute(fix42secdef.Route(app.OnFIX42SecurityDefinition)) router.AddRoute(fix43secdef.Route(app.OnFIX43SecurityDefinition)) router.AddRoute(fix44secdef.Route(app.OnFIX44SecurityDefinition)) router.AddRoute(fix50secdef.Route(app.OnFIX50SecurityDefinition)) router.AddRoute(fix50sp1secdef.Route(app.OnFIX50SP1SecurityDefinition)) router.AddRoute(fix50sp2secdef.Route(app.OnFIX50SP2SecurityDefinition)) cfg, err := os.Open(os.Args[1]) if err != nil { fmt.Printf("Error opening %v, %v\n", os.Args[1], err) return } appSettings, err := quickfix.ParseSettings(cfg) if err != nil { fmt.Println("Error reading cfg:", err) return } fileLogFactory, err := quickfix.NewFileLogFactory(appSettings) if err != nil { fmt.Println("Error creating file log factory:", err) return } acceptor, err := quickfix.NewAcceptor(app, quickfix.NewMemoryStoreFactory(), appSettings, fileLogFactory) if err != nil { fmt.Println("Unable to create Acceptor: ", err) return } if err = acceptor.Start(); err != nil { fmt.Println("Unable to start Acceptor: ", err) return } interrupt := make(chan os.Signal) signal.Notify(interrupt) <-interrupt acceptor.Stop() }
func newExecutor() *executor { e := &executor{MessageRouter: quickfix.NewMessageRouter()} e.AddRoute(fix40nos.Route(e.OnFIX40NewOrderSingle)) e.AddRoute(fix41nos.Route(e.OnFIX41NewOrderSingle)) e.AddRoute(fix42nos.Route(e.OnFIX42NewOrderSingle)) e.AddRoute(fix43nos.Route(e.OnFIX43NewOrderSingle)) e.AddRoute(fix44nos.Route(e.OnFIX44NewOrderSingle)) e.AddRoute(fix50nos.Route(e.OnFIX50NewOrderSingle)) return e }