public void OnSessionLogout(IVfxFixAppSession session, FixMessage msg) { FixField fixSCID = msg.Header.GetField(49); FixField fixTCID = msg.Header.GetField(56); Console.WriteLine(string.Format("FIX CLIENT: {0} - LOGOUT.", fixSCID.Content)); }
public void OnSessionLogout(IVfxFixAppSession session, FixMessage msg) { FixField fixSCID = msg.Header.GetField(49); FixField fixTCID = msg.Header.GetField(56); Console.WriteLine(string.Format("FIX SERVER: {0} - LOGOUT.", fixSCID.Content)); }
/// <summary> /// The OnSessionRxAppMessage callback is invoked by a session /// when it receives an application layer message from the peer /// session it's interacting with. /// </summary> /// <param name="session"> /// The IVfxFixSession implementation that is issuing the /// callback to the handler. /// </param> /// <param name="msg"> /// The application message that the session has received /// from its corresponding peer session. /// </param> public void OnSessionRxAppMessage(IVfxFixSession session, FixMessage msg) { if (_mapAppSessions.ContainsKey(session.InstanceId)) { IVfxFixAppSession appSession = _mapAppSessions[session.InstanceId]; _application.OnSessionRxAppMessage(appSession, msg); } }
/// <summary> /// The OnSessionStarted callback method is invoked by an /// instance of a session when it is activated. /// </summary> /// <param name="session"> /// The FIX session that the event relates to. /// </param> public void OnSessionOpened(IVfxFixSession session) { if (_mapAppSessions.ContainsKey(session.InstanceId)) { IVfxFixAppSession appSession = _mapAppSessions[session.InstanceId]; _application.OnSessionOpened(appSession); } }
public void OnSessionLogon(IVfxFixAppSession session, FixMessage msg) { FixField fixSCID = msg.Header.GetField(49); FixField fixTCID = msg.Header.GetField(56); Console.WriteLine(string.Format("FIX CLIENT: {0} - LOGON", fixSCID.Content)); System.Threading.ThreadPool.QueueUserWorkItem(HandleWork_SendMessages, session); }
/// <summary> /// The OnSessionLogon callback method is invoked by an /// instance of a session when it completes a logon with /// the peer system it's communicating with. /// </summary> /// <param name="session"> /// The IVfxFixSession implementation that is issuing /// the callback to the handler. /// </param> /// <param name="msg"> /// The FIX logon message (request or response) that was /// received from the peer session. /// </param> public void OnSessionLogon(IVfxFixSession session, FixMessage msg) { // REC: Forward the callback to the appropriate method // on the application's callback interface: if (_mapAppSessions.ContainsKey(session.InstanceId)) { IVfxFixAppSession appSession = _mapAppSessions[session.InstanceId]; _application.OnSessionLogon(appSession, msg); } }
/// <summary> /// The OnSessionStopped callback method is invoked in response /// to an instance of a session being shutdown. /// </summary> /// <param name="session"> /// The FIX session that the event relates to. /// </param> public void OnSessionClosed(IVfxFixSession session) { // REC: Determine which application session corresponds to // the FIX session that the event is coming from and route // the appropriate notification to it. if (_mapAppSessions.ContainsKey(session.InstanceId)) { IVfxFixAppSession appSession = _mapAppSessions[session.InstanceId]; _application.OnSessionClosed(appSession); } // REC: If there is currently an IPC session in place // that corresponds to the FIX session, it needs to be // disconnected at this point: if (_mapFixToIpc.ContainsKey(session.InstanceId)) { _endpoint.Shutdown(_mapFixToIpc[session.InstanceId]); } else { // REC: Since the FIX session has been closed, it can // be removed from the active sessions map: if (_mapFixSessions.ContainsKey(session.InstanceId)) { _mapFixSessions.Remove(session.InstanceId); } } if (_serviceState == VfxFixServiceStates.Service_State_Closing) { if (_mapFixSessions.Count == 0) { // REC: Adjust the service's state: _serviceState = VfxFixServiceStates.Service_State_Closed; // REC: Adjust the service's status: _serviceStatus = VfxFixServiceStatus.Service_Status_Closed; // REC: Dispatch the closed event: EventHandler <VfxFixServiceEventArgs> tmpDispatch = EventDispatch; if (tmpDispatch != null) { VfxFixServiceEventArgs args = new VfxFixServiceEventArgs(VfxFixServiceEventTypes.Event_Service_Stopped, _serviceStatus); tmpDispatch(this, args); } } } }
/// <summary> /// The OnSessionTxAppMessage callback is invoked by a session /// when it is ready to dispatch an application message to the /// peer session it's interacting with. /// </summary> /// <param name="session"> /// The IVfxFixSession implementation that is issuing the /// callback to the handler. /// </param> /// <param name="msg"> /// The application message that the session wants to have sent /// to its corresponding peer session. /// </param> public void OnSessionTxAppMessage(IVfxFixSession session, FixMessage msg) { if (_mapAppSessions.ContainsKey(session.InstanceId)) { IVfxFixAppSession appSession = _mapAppSessions[session.InstanceId]; _application.OnSessionTxAppMessage(appSession, msg); // REC: Locate the IPC session identifier of the IPC session // that is associated with the service that is generating the // event and use that to send the message to the peer: if (_mapFixToIpc.ContainsKey(session.InstanceId)) { string ipcIdentifier = _mapFixToIpc[session.InstanceId]; _endpoint.Send(ipcIdentifier, new VfxMsgBlock(msg.ToString())); } } }
private void HandleWork_SendMessages(object state) { int orderId = 1; IVfxFixAppSession session = state as IVfxFixAppSession; for (int i = 0; i != 5; i++) { FixMessage msg = new FixMessage(); msg.Header.SetField(new FixField(35, "8")); msg.Content.SetField(new FixField(37, orderId++.ToString())); msg.Content.SetField(new FixField(17, "5000")); msg.Content.SetField(new FixField(20, "0")); msg.Content.SetField(new FixField(150, "0")); msg.Content.SetField(new FixField(39, "0")); msg.Content.SetField(new FixField(55, "AAPL")); msg.Content.SetField(new FixField(54, "1")); msg.Content.SetField(new FixField(151, "3000")); msg.Content.SetField(new FixField(14, "0")); msg.Content.SetField(new FixField(6, "0")); FixGroup grpTest = new FixGroup(382, "2"); FixCollection grpInstance = new FixCollection(); grpInstance.AddField(new FixField(375, "foo")); grpInstance.AddField(new FixField(337, "bar")); grpTest.Instances.Add(grpInstance); grpTest.Instances.Add(grpInstance); msg.Content.AddGroup(grpTest); session.Send(msg); } if (session != null) { for (int i = 0; i != 10000; i++) { FixMessage message = new FixMessage(); message.Header.AddField(new FixField(35, "D")); session.Send(message); } } }
public void OnSessionOpened(IVfxFixAppSession session) { Console.WriteLine("FIX Client: Session opened..."); }
public void OnSessionClosed(IVfxFixAppSession session) { Console.WriteLine("FIX CLIENT: - Session Closed."); }
public void OnSessionClosed(IVfxFixAppSession session) { }
public void OnSessionTxAppMessage(IVfxFixAppSession session, FixMessage msg) { }
public void OnSessionRxAdmMessage(IVfxFixAppSession session, FixMessage msg) { FixField fixSCID = msg.Header.GetField(49); Console.WriteLine(string.Format("FIX CLIENT: {0} SENT: {1}", fixSCID.Content, msg.ToString())); }
public void OnSessionOpened(IVfxFixAppSession session) { Console.WriteLine("FIX Server: Session opened..."); }
public void OnSessionRxAppMessage(IVfxFixAppSession session, FixMessage msg) { FixField fixSCID = msg.Header.GetField(49); Console.WriteLine(string.Format("FIX SERVER: {0} SENT: {1}", fixSCID.Content, msg.ToString())); }