<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1365133043;
mso-list-type:hybrid;
mso-list-template-ids:1425316652 134807567 134807577 134807579 134807567 134807577 134807579 134807567 134807577 134807579;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">A rejection usually comes with a RefSeqNum that refers to the sequence number of the message being rejected. If you have access to your MessageStore, you can invoke MessageStore.Get() to retrieve it (passing
in the seqNum as both start/end, and additionally, a string-list for the function to populate). This gives you the raw string, which you then need to use the msgFactory to create an explicit Message for.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I added the following to Session.cs to do this:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><i><span style="color:#1F497D">public Message GetMessage(int seqNum)<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D">{<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> List<string> refMessageList = new List<string>();<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> MessageStore.Get(seqNum, seqNum, refMessageList);<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> if (refMessageList.Count != 1)<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> {<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> throw new Exception(string.Format("Could not find seqnum={0}", seqNum));<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> }<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> string msgStr = refMessageList[0];<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> MsgType msgType = Message.IdentifyType(msgStr);<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> string beginString = Message.ExtractBeginString(msgStr);<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"><o:p> </o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> Message message = msgFactory_.Create(beginString, msgType.Obj);<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> message.FromString(<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> msgStr,<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> this.ValidateLengthAndChecksum,<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> this.SessionDataDictionary,<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> this.ApplicationDataDictionary,<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> this.msgFactory_);<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"><o:p> </o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D"> return message;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#1F497D">}<o:p></o:p></span></i></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Note, I think you might be able to do this outside of Sesssion.cs (I think the specific MessageStore is exposed on Session, and the MessageFactory you should have passed in), but this is how I did it at the time.
Let me know if this works for you (or if others have a better way of doing it).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Phil<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> quickfixn-bounces@lists.quickfixn.com [mailto:quickfixn-bounces@lists.quickfixn.com]
<b>On Behalf Of </b>Tim Bailey [ATEO]<br>
<b>Sent:</b> Monday, January 06, 2014 8:57 AM<br>
<b>To:</b> quickfixn@lists.quickfixn.com<br>
<b>Subject:</b> {{Quickfixn}} Is it possible to retreive the message associated with a reject programatically?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB">Hi <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">I have a requirement in which I need to get the message sent whenever we receive a reject message. I can see that we should be able to do this using the SessionState.Get method, but how do I access this as SessionState
appears to be a private member of Session.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">To clarify what we are wishing to achieve:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><![if !supportLists]><span lang="EN-GB"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span lang="EN-GB">Message sent to client.<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><![if !supportLists]><span lang="EN-GB"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span lang="EN-GB">Client sends a reject message.<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><![if !supportLists]><span lang="EN-GB"><span style="mso-list:Ignore">3.<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span lang="EN-GB">We need to programmatically get the message which the reject was set in response to.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">This will be for both Reject and BusinessMessageReject messages.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Thanks for any assistance.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;line-height:11.25pt"><b><span style="font-size:8.5pt;font-family:"Verdana","sans-serif";color:#505AE6;mso-fareast-language:FR">Tim Bailey</span></b><span style="font-size:8.5pt;font-family:"Verdana","sans-serif";color:#505AE6;mso-fareast-language:FR">
</span><span lang="EN-GB" style="mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
</div>
</body>
</html>