<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" link="#0563C1" vlink="#954F72">
<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" link="#0563C1" vlink="#954F72"><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" link="#0563C1" vlink="#954F72"><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>