{{Quickfixn}} How Should A Session Be Closed

Mike Gatny mgatny at connamara.com
Wed Mar 15 06:14:08 PDT 2017


Hi Ian,

Could you provide a little background on what your use case is for stopping
particular Sessions manually?
It is more typical to let the Initiator manage stopping and starting
Sessions for you, e.g. using the StartTime/EndTime SessionSettings, or by
calling Stop() on the Initiator itself to stop all Sessions.
Depending on your use case the Initiaiator's AddSession/RemoveSession
methods might be useful to you.  See:
https://github.com/connamara/quickfixn/blob/master/QuickFIXn/AbstractInitiator.cs#L130-L157

--
Mike Gatny
Connamara Systems, LLC

On Wed, Mar 15, 2017 at 6:10 AM, Ian Clements <ian at investmentsoftwareltd.com
> wrote:

> Hi all,
>
>
>
> Currently I have the code below to stop a Session.
>
>
>
>                 try { session.Disconnect("FIX Engine: Stopped."); }
>
>                 catch (Exception ex)
>
>                 {
>
>                     var msg = string.Format("FIX Engine: Session
> Disconnect Error for {0} - {1}", sessionID.ToString(), ex.ToString());
>
>                     logger.Write(msg, System.Diagnostics.EventLogEntryType.Error,
> LoggerPriority.High);
>
>                 }
>
>                 session = null;
>
>
>
> However we have intermittently been getting the following error when our
> FIX engine restarts –
>
>
>
> Description: The process was terminated due to an unhandled exception.
>
> Exception Info: System.ObjectDisposedException
>
> Stack:
>
>    at QuickFix.FileLog.OnEvent(System.String)
>
>    at QuickFix.Transport.SocketInitiator.SocketInitiatorThreadStart(
> System.Object)
>
>    at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,
> System.Threading.ContextCallback, System.Object, Boolean)
>
>    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,
> System.Threading.ContextCallback, System.Object, Boolean)
>
>    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,
> System.Threading.ContextCallback, System.Object)
>
>    at System.Threading.ThreadHelper.ThreadStart(System.Object)
>
>
>
> Is this potentially due to us not disconnecting properly?  Should I be
> calling Logout and then Disconnect or just Logout?
>
>
>
> Many thanks,
>
>
>
>
>
> _______________________________________________
> Quickfixn mailing list
> Quickfixn at lists.quickfixn.com
> http://lists.quickfixn.com/listinfo.cgi/quickfixn-quickfixn.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quickfixn.com/pipermail/quickfixn-quickfixn.com/attachments/20170315/62dbcab4/attachment-0002.htm>


More information about the Quickfixn mailing list