@@ -7,8 +7,12 @@ import (
77 "log"
88 "os"
99 "os/signal"
10+ "path"
11+ "strings"
12+ "time"
1013
1114 "github.com/quickfixgo/quickfix"
15+ "github.com/quickfixgo/quickfix/config"
1216 field "github.com/quickfixgo/quickfix/gen/field"
1317 tag "github.com/quickfixgo/quickfix/gen/tag"
1418)
@@ -131,7 +135,21 @@ func main() {
131135 return
132136 }
133137
134- acceptor , err := quickfix .NewAcceptor (app , quickfix .NewMemoryStoreFactory (), appSettings , fileLogFactory )
138+ storeType := os .Args [2 ]
139+
140+ var acceptor * quickfix.Acceptor
141+ switch strings .ToUpper (storeType ) {
142+ case "FILE" :
143+ fileStoreRootPath := path .Join (os .TempDir (), fmt .Sprintf ("FileStoreTestSuite-%d" , os .Getpid ()))
144+ fileStorePath := path .Join (fileStoreRootPath , fmt .Sprintf ("%d" , time .Now ().UnixNano ()))
145+ appSettings .GlobalSettings ().Set (config .FileStorePath , fileStorePath )
146+ acceptor , err = quickfix .NewAcceptor (app , quickfix .NewFileStoreFactory (appSettings ), appSettings , fileLogFactory )
147+ case "MEMORY" :
148+ acceptor , err = quickfix .NewAcceptor (app , quickfix .NewMemoryStoreFactory (), appSettings , fileLogFactory )
149+ default :
150+ acceptor , err = quickfix .NewAcceptor (app , quickfix .NewMemoryStoreFactory (), appSettings , fileLogFactory )
151+ }
152+
135153 if err != nil {
136154 fmt .Println ("Unable to create Acceptor: " , err )
137155 return
0 commit comments