<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas">Hello,</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> I have created a
application to send messages between client-server and I am having a problem on
server side.I want to write the incoming NewOrderSingle message( .body
extension file) files in store folder on server side.The newordersingle message
along with executionreport message get written into store file on client side.
but on server side I don’t get application messages(file with .body extension)
in store file. How to write the incoming application messages to the file and
not the admin messages. My sample code is as follows.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas;color:blue">public</span><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:
blue">class</span> <span style="color:#2B91AF">clsFIXServer</span> : QuickFix.<span style="color:#2B91AF">MessageCracker</span>, QuickFix.<span style="color:#2B91AF">IApplication</span><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">public</span> <span style="color:blue">void</span>
FromApp(QuickFix.<span style="color:#2B91AF">Message</span> message, QuickFix.<span style="color:#2B91AF">SessionID</span> sessionID)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:#2B91AF">Console</span>.WriteLine(<span style="color:#A31515">"IN: "</span>
+ message);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> Crack(message, sessionID);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">public</span> <span style="color:blue">void</span>
OnCreate(QuickFix.<span style="color:#2B91AF">SessionID</span> sessionID)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">public</span> <span style="color:blue">void</span> OnLogon(QuickFix.<span style="color:#2B91AF">SessionID</span>
sessionID)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">public</span> <span style="color:blue">void</span> OnLogout(QuickFix.<span style="color:#2B91AF">SessionID</span>
sessionID)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">public</span> <span style="color:blue">void</span> ToAdmin(QuickFix.<span style="color:#2B91AF">Message</span>
message, QuickFix.<span style="color:#2B91AF">SessionID</span> sessionID)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">public</span> <span style="color:blue">void</span> ToApp(QuickFix.<span style="color:#2B91AF">Message</span>
message, QuickFix.<span style="color:#2B91AF">SessionID</span> sessionId)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:#2B91AF">Console</span>.WriteLine(<span style="color:#A31515">"OUT: "</span> + message);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> QuickFix.FIX44.<span style="color:#2B91AF">ExecutionReport</span>
exReport = <span style="color:blue">new</span> QuickFix.FIX44.<span style="color:#2B91AF">ExecutionReport</span>(<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">new</span>
<span style="color:#2B91AF">OrderID</span>(GenOrderID()),<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">new</span>
<span style="color:#2B91AF">ExecID</span>(GenExecID()),<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">new</span>
<span style="color:#2B91AF">ExecType</span>(<span style="color:#2B91AF">ExecType</span>.FILL),<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">new</span>
<span style="color:#2B91AF">OrdStatus</span>(<span style="color:#2B91AF">OrdStatus</span>.FILLED),<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> symbol, <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> side,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">new</span>
<span style="color:#2B91AF">LeavesQty</span>(0),<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">new</span>
<span style="color:#2B91AF">CumQty</span>(orderQty.getValue()),<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">new</span>
<span style="color:#2B91AF">AvgPx</span>(price.getValue()));<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> exReport.Set(clOrdID);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> exReport.Set(symbol);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> exReport.Set(orderQty);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> exReport.Set(<span style="color:blue">new</span> <span style="color:#2B91AF">LastQty</span>(orderQty.getValue()));<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> exReport.Set(<span style="color:blue">new</span> <span style="color:#2B91AF">LastPx</span>(price.getValue()));<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">if</span>
(n.IsSetAccount())<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> exReport.SetField(n.Account);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">try</span><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:#2B91AF">Session</span>.SendToTarget(exReport,
s);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">catch</span>
(<span style="color:#2B91AF">SessionNotFound</span> ex)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:#2B91AF">Console</span>.WriteLine(<span style="color:#A31515">"==session not found exception!=="</span>);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:#2B91AF">Console</span>.WriteLine(ex.ToString());<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:blue">catch</span>
(<span style="color:#2B91AF">Exception</span> ex)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> <span style="color:#2B91AF">Console</span>.WriteLine(ex.ToString());<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas">}<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial">My client side function
that creates the newordersingle message :-<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial">public void Run()<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial">{<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial">objEMSOrder =
((FIXFormatter.EMSOrder)messageQueue.Receive().Body);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial">if
(this._session.SessionID.BeginString == "FIX.4.4")<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> QuickFix.FIX44.NewOrderSingle m = objMessageCreator.NewOrderSingle44MessageCreator(objEMSOrder);
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> <b>//DLL FUNCTION THAT CREATES MESSAGE <o:p></o:p></b></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> if
(m != null)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> m.Header.GetField(Tags.BeginString);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> SendMessage(m);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-size:10.0pt;mso-bidi-font-family:Arial">}<o:p></o:p></span></p> </div></body>
</html>