Re: [Quickfix-developers] Session.SendToTarget issue
Brought to you by:
orenmnero
|
From: Alexander G. <ago...@ac...> - 2006-02-22 17:02:43
|
Hello,
My guess is that you chose the wrong sendToTarget() method signature. In =
your method "GLOBEX" is a session qualifier. If "GLOBEX" is a =
targetCompId, than you need to use the sendToTarget(message, =
senderCompID, targetCompID).
Best regards,
Alexander
----- Original Message -----=20
From: Mike Smith=20
To: qui...@li...=20
Sent: Wednesday, February 22, 2006 5:44 PM
Subject: [Quickfix-developers] Session.SendToTarget issue
I'm just starting out with QuickFix, so I'm sure this is a very =
beginner level question.
=20
I'm coding in c# 2.0 and have setup my solution very much like the =
example executor solution. The only thing is, is that I'm instantiating =
a ThreadedSocketInitiator instead of an Acceptor, because I want to send =
out new orders, cancels, etc. I'm logging in fine and heartbeating, but =
when I build a new order message and try to send it, I get the following =
error.
=20
[QuickFix.SessionNotFound] =3D {"Exception of type =
'QuickFix.SessionNotFound' was thrown."}
=20
From looking at the examples, I can't see why I'm getting this error. =
I've verified that the SessionIdentifier is correct and I am =
heartbeating, so I know the session is active.
=20
Below is my code in Application.cs
=20
public class Application: MessageCracker, QuickFix.Application
{
public void onLogon(SessionID sessionID) { }
public void onLogout(SessionID sessionID) { }
public void toApp(Message message, SessionID sessionID) { }
public void fromAdmin(Message message, SessionID sessionID) { =
}
public void fromApp(Message message, SessionID sessionID) { }
=20
public void toAdmin(Message message, SessionID sessionID)
{
message.setField(new SenderSubID("060"));
message.setField(new SenderLocationID("060"));
message.setField(new TargetSubID("G"));
message.setField(new RawData("HGY"));
message.setField(new RawDataLength(3));
}
public void onCreate(SessionID sessionID) { }
=20
public void SendMessage(Message message)
{
Session.sendToTarget(message, "GLOBEX");
}
}
=20
SendMessage is called from an event handler in the main class.
=20
Here is the main class.
=20
class Program
{
#region "PRIVATE FIELDS"
=20
private Application application =3D new =
QuickFixConsole.Application();
=20
#endregion
=20
#region "ENTRYPOINT"
=20
static void Main(string[] args)
{
try
{
Program program =3D new Program();
SessionSettings settings =3D new =
SessionSettings("C:\\Source\\backup\\API.NET\\Session.config");
Application application =3D new =
QuickFixConsole.Application();
MSSQLStoreFactory storeFactory =3D new =
MSSQLStoreFactory(settings);
MessageFactory messageFactory =3D new =
DefaultMessageFactory();
ScreenLogFactory logFactory =3D new =
ScreenLogFactory(true,true,true);
ThreadedSocketInitiator initiator =3D new =
ThreadedSocketInitiator(application, storeFactory, settings, logFactory, =
messageFactory);
initiator.start();
=20
Globex globex =3D new Globex("c:\\Orders", "*.FIX", =
new MessageHandler(program.Program_OnMessage));
globex.StartProcessor();
=20
Console.WriteLine("press <enter> to quit");
Console.Read();
initiator.stop();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
=20
#endregion
=20
#region EVENT HANDLERS
=20
private void Program_OnMessage(Message message)
{
try
{
application.SendMessage(message);
//Session.sendToTarget(message, "GLOBEX");
}
catch (Exception ex)
{
throw ex;
}
}
=20
#endregion
=20
Any and all help is greatly appreciated.
=20
Thanks,
Mike
=20
=20
=20
|