RE: [Quickfix-developers] Session.SendToTarget issue
Brought to you by:
orenmnero
|
From: Mike S. <MS...@rj...> - 2006-02-22 17:23:14
|
Alexander,
=20
Thanks for your quick response. I got it to work, but I'm still a bit
confused.
=20
I tried sendToTarget(message, senderCompID, targetCompID) and that
didn't work.
I then tried sendToTarget(message, senderCompID, targetCompID,
qualifier) and that worked.
=20
I've only got one session active, so I would think that
sendToTarget(message) would work fine. =20
=20
Also, the qualifier value that I put as the 4th parameter of
sendToTarget listed above is the same qualifier value I put when calling
sendToTarget(message, qualifier), which didn't work.
=20
Again, it is working now, and I greatly appreciate your help.
=20
Thanks,
Mike
=20
________________________________
From: Alexander Gorbachev [mailto:ago...@ac...]=20
Sent: Wednesday, February 22, 2006 11:03 AM
To: Mike Smith; qui...@li...
Subject: Re: [Quickfix-developers] Session.SendToTarget issue
=20
Hello,
=20
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).
=20
Best regards,
Alexander
=20
----- Original Message -----=20
From: Mike Smith <mailto:MS...@rj...> =20
To: qui...@li...=20
Sent: Wednesday, February 22, 2006 5:44 PM
Subject: [Quickfix-developers] Session.SendToTarget issue
=20
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
|