import quickfix.*;
import java.io.FileInputStream;
public class QFJInitiator {
public static void main(String args[]) throws Exception {
if (args.length != 1) return;
// path to file with session's configuration
String fileName = args[0];
// FooApplication is your class that implements the Application interface
Application application = new FooApplication();
SessionSettings settings = new SessionSettings(new FileInputStream(fileName));
MessageStoreFactory storeFactory = new FileStoreFactory(settings);
MessageFactory messageFactory = new DefaultMessageFactory();
Initiator initiator =
new SocketInitiator(application, storeFactory, settings, messageFactory);
initiator.start();
// preventing application from exiting
System.out.println("Press enter to exit");
System.in.read();
initiator.stop();
}
}
|