|
From: t.s. <tru...@cb...> - 2007-05-10 20:36:03
|
Hello everyone,
It's me again :) Here's the outline of the code so far
...
public static void main(String[] args) throws Exception {
String filename = "config.cfg";
Application application = new Main();
SessionSettings settings = new SessionSettings(
new FileInputStream(filename));
MessageStoreFactory storeFactory = new FileStoreFactory(settings);
LogFactory logFactory = new FileLogFactory(settings);
MessageFactory messageFactory = new DefaultMessageFactory();
Initiator initiator = new SocketInitiator ( application, storeFactory,
settings, logFactory, messageFactory);
initiator.start();
//1. create a QuoteRequest object
//2. init fields
//3. send QuoteRequest
//4. how to receive quotes ? via fromApp() ?
//5. disconnect/housekeeping
initiator.stop();
}
...
I have several questions at this point:
1. How does QuickFix negotiate login ? Couldn't find anything on the
subject in the documentation.
2. If i understand correctly, we're supposed to get messages via the
fromApp() event, (see #4 in code above), but I'm not sure how the
program flow should work, since this is a single threaded code. Do i
have to add a busy loop somewhere, like:
...
initiator.start();
sendSomeMessageToTheOtherSide();
while (flag == 0) do { waitaround() }; //catch msg via fromApp();
disconnectAndCleanup();
initiator.stop();
...
3. I managed to scrape together a configuration file from the docs to
use with my code, but i feel a bit uneasy about the approach. Is the
config file mandatory ? Can't i just set the settings via code ?
4. In the code above, i think it's assumed that quickfix/j will create a
default session for my use, but what to do when we need to use more than
one? (probably a bit too advanced for me at this point, and sorry if
this is a RTFM question).
5. Still related to question #3 and #4, a settings/config file can
define multiple session parameter, how do we specify which one to use? I
can't see how these things work together. For example, from the code above,
...
SessionSettings settings = new SessionSettings(
new FileInputStream(filename));
... followed by ...
Initiator initiator = new SocketInitiator (application, storeFactory,
settings, logFactory, messageFactory);
...
So initiator is initiated by the settings file, but if the settings file
have multiple sessions, how do quickfixj tell which one to use?
Thank you very much in advance,
Regards,
t.s.
PS: Found some issues with the documentation... Where should i report this?
1. In the 'sending messages' chapter, the following source code is given
in the last section, the 'Most Type Safe' one.
...
void sendOrderCancelRequest()
{
quickfix.fix41.OrderCancelRequest message(
new OrigClOrdID("123"),
new ClOrdID("321"),
new Symbol("LNUX"),
new Side(Side.BUY));
message.set(new Text("Cancel My Order!"));
Session.sendToTarget(message, "TW", "TARGET");
}
...
I'm having problem with the line that creates the message object, since
it doesn't even look like valid java code. I was guessing that it meant
something like :
...
OrderCancelRequest ocr = new OrderCancelRequest(blah blah);
...
but it turns out that the constructor has no parameter.
2. There's a small typo at
http://www.quickfixj.org/quickfixj/usermanual/usage/configuration.html
> [DEFAULT]
> ConnectionType=initator <<<< HERE
> ReconnectInterval=60
The usermanual distributed with the latest quickfixj appeared to have
fixed this.
3. Earlier, i keep getting problems with NoClassDefFoundError
Exceptions, problem solved after including the JARs in \lib directory in
my project (using netbeans, btw). Maybe this should be pointed out in
the documentation ?
|