示例#1
0
        /// <summary>
        /// The HandleIpcDispatch_EventOpened event handler is invoked in
        /// response to a new session being established between a peer
        /// system and the endpoint associated with the service.
        /// </summary>
        /// <param name="sender">
        /// The IPC endpoint that dispatched the event.
        /// </param>
        /// <param name="args">
        /// The details of the event being dispatched.
        /// </param>
        private void HandleIpcDispatch_EventOpened(object sender, VfxIpcEventArgs args)
        {
            // REC: Create a new instance of a FIX session to handle
            // the communication between the server and the peer:
            IVfxFixSession fixSession = null;

            // REC: Retrieve the version definition from the version
            // definition registry and determine what kind of session
            // needs to be created in order to handle the connection:
            IVfxFixVxRegistry vxRegistry = this._localServices.GetService(typeof(IVfxFixVxRegistry)) as IVfxFixVxRegistry;

            // REC: Check the version definition in order to tell if
            // this is a FIX 4.x or FIX 5.x service:
            VfxFixVxRecord vxRecord = vxRegistry.Get(this._sxVersion);

            if (vxRecord.Layer.ToLower().CompareTo("combined") == 0)
            {
                fixSession = new VfxFix4xServerSession();
            }
            else
            {
                fixSession = new VfxFix5xServerSession();
            }


            // REC: Initialize the session:
            fixSession.Init(_localServices, this);

            // REC: Create an entry for the session in the
            // local session map:
            _mapFixSessions.Add(fixSession.InstanceId, fixSession);

            // REC: Bind the FIX session to the IPC session:
            _mapFixToIpc.Add(fixSession.InstanceId, args.Token);
            // REC: Bind the IPC session to the FIX session:
            _mapIpcToFix.Add(args.Token, fixSession.InstanceId);

            // REC: Create the application session container
            // that will be passed to the app implementation
            // when events are generated on the session:
            VfxFixServerSession appSession = new VfxFixServerSession(fixSession);

            // REC: Create a binding between the FIX session
            // and the application session so that events from
            // the FIX session can be correlated to the correct
            // application session when events are dispatched to
            // the user's FIX application instance:
            _mapAppSessions.Add(fixSession.InstanceId, appSession);

            // REC: Inform the session that a peer system
            // has been connected to it:
            fixSession.HandleConnect();
        }
示例#2
0
        /// <summary>
        /// The HandleIpcDispatch_EventOpened event handler is invoked in
        /// response to a new session being established between a peer
        /// system and the endpoint associated with the service.
        /// </summary>
        /// <param name="sender">
        /// The IPC endpoint that dispatched the event.
        /// </param>
        /// <param name="args">
        /// The details of the event being dispatched.
        /// </param>
        private void HandleIpcDispatch_EventOpened(object sender, VfxIpcEventArgs args)
        {
            // REC: Create a new instance of a FIX session to handle
            // the communication between the server and the peer:
            IVfxFixSession fixSession = null;

            // REC: Retrieve the version definition from the version
            // definition registry and determine what kind of session
            // needs to be created in order to handle the connection:
            IVfxFixVxRegistry vxRegistry = this._localServices.GetService(typeof(IVfxFixVxRegistry)) as IVfxFixVxRegistry;

            // REC: Check the version definition in order to tell if
            // this is a FIX 4.x or FIX 5.x service:
            VfxFixVxRecord vxRecord = vxRegistry.Get(this._sxVersion);
            if (vxRecord.Layer.ToLower().CompareTo("combined") == 0)
            {
                fixSession = new VfxFix4xServerSession();
            }
            else
            {
                fixSession = new VfxFix5xServerSession();
            }

            // REC: Initialize the session:
            fixSession.Init(_localServices, this);

            // REC: Create an entry for the session in the
            // local session map:
            _mapFixSessions.Add(fixSession.InstanceId, fixSession);

            // REC: Bind the FIX session to the IPC session:
            _mapFixToIpc.Add(fixSession.InstanceId, args.Token);
            // REC: Bind the IPC session to the FIX session:
            _mapIpcToFix.Add(args.Token, fixSession.InstanceId);

            // REC: Create the application session container
            // that will be passed to the app implementation
            // when events are generated on the session:
            VfxFixServerSession appSession = new VfxFixServerSession(fixSession);

            // REC: Create a binding between the FIX session
            // and the application session so that events from
            // the FIX session can be correlated to the correct
            // application session when events are dispatched to
            // the user's FIX application instance:
            _mapAppSessions.Add(fixSession.InstanceId, appSession);

            // REC: Inform the session that a peer system
            // has been connected to it:
            fixSession.HandleConnect();
        }