<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<div style="font-size:10pt">
<p style="margin-top:0; margin-bottom:0">Thanks Mike hadn't thought of that will give it a go much more elegant than my solution.   Have been seeing a lot of aggressive seq resets from our provider but probably more down to my ignorance of fix protocol! </p>
<p style="margin-top:0; margin-bottom:0">------ Original message------</p>
<p style="margin-top:0; margin-bottom:0"><b>From: </b>Mike Gatny</p>
<p style="margin-top:0; margin-bottom:0"><b>Date: </b>Fri, 25 Sep 2015 18:28</p>
<p style="margin-top:0; margin-bottom:0"><b>To: </b>Mailing list for QuickFIX/n;</p>
<p style="margin-top:0; margin-bottom:0"><b>Subject:</b>Re: {{Quickfixn}} Recovery Strategies</p>
<p style="margin-top:0; margin-bottom:0"> </p>
</div>
<div>
<div dir="ltr">
<div class="gmail_extra">
<div>
<div class="gmail_signature">
<div dir="ltr">On Fri, Sep 25, 2015 at 11:50 AM, Ian Clements <span dir="ltr"><<a href="mailto:ian.clements@investmentsoftwareltd.com" target="_blank">ian.clements@investmentsoftwareltd.com</a>></span> wrote:<br>
</div>
</div>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div lang="EN-GB">
<div>
<p class="MsoNormal">If my service crashes (Server fails or unhandled exception) then my queue which is in memory gets lost.  When I restore my service I need to load these messages back into the queue.<br>
</p>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>One slick way to do this is to leverage FIX protocol resends.  If you make the msg seq num part of the data you record when a message is successfully processed, when a crash occurs you can 1) note the last processed seq num, 2) edit the qf/n .seqnums file
 accordingly, 3) restart your app.  The other side will resend what you haven't processed.<br>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div lang="EN-GB">
<div>
<p class="MsoNormal">If the crash happened during the current FIX session I was tracking which SeqNum I had reached in my DB so I figured in the OnCreate method I could just retrieve the messages from the message store but it is returning nothing which I don’t
 understand as the store files are still populated.</p>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>The message store is for messages you sent, not messages you received.  They are stored in case you need to honor a resend request from the other side.  And hence the method mentioned above.</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div lang="EN-GB">
<div>
<p class="MsoNormal">If I have done a LogOut (Which clears the store files as the collection resets) and I am still processing messages I persist the messages currently on the queue to a file which I can then restore – this approach seems to work.</p>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Yep, you have to go to disk one way or another -- whether it is writing to your own ad-hoc file, re-reading the qf messages log, writing to a durable msg queue, writing to a db.  As long as you can avoid blocking too long during FromApp/OnMessage, any
 of these can work.</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>