Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update from latest master, fix some typos #1

Merged
merged 32 commits into from
Jun 10, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9298f97
Add RefreshOnLogon functionality.
martinadams Nov 16, 2014
4bc599b
Add new Application Callback (non-breaking) for early intercept of in…
martinadams Nov 17, 2014
adb2761
Merge branch 'add_refresh' into rx_intercept
martinadams Nov 24, 2014
4ed14c5
Dynamic session configuration.
martinadams Dec 2, 2014
469392f
Merge branch 'add_refresh' into dynamic_sessions
martinadams Dec 2, 2014
446d42e
Merge branch 'rx_intercept' into dynamic_sessions
martinadams Dec 2, 2014
42ddebe
Dynamic sessions
martinadams Dec 14, 2014
234ff56
Revert "Fix distributed deadlock between two sessions"
gbirchmeier Jan 2, 2015
2e61171
release notes
gbirchmeier Jan 2, 2015
4f3abdc
these should have been committed long ago
gbirchmeier Mar 19, 2015
662313c
Merge pull request #290 from martinadams/add_refresh
gbirchmeier May 7, 2015
ddea749
attribution for #290
gbirchmeier May 7, 2015
5820c4e
Changes as requested to tab/indents and comments
martinadams May 13, 2015
646f43d
Unit Test + minor code updates for dynamic sessions
martinadams May 18, 2015
aaacb04
Revert "Merge branch 'rx_intercept' into dynamic_sessions"
martinadams May 19, 2015
43b73f6
Dynamic sessions: whitespace fix only
martinadams May 19, 2015
65eeeaf
Merge pull request #291 from martinadams/rx_intercept
mgatny Jun 1, 2015
fdfe748
(#80) AT: logon with reset after disconnect
gbirchmeier Jun 8, 2015
b632b69
Merge pull request #316 from gbirchmeier/80reset
gbirchmeier Jun 8, 2015
fb2f776
(#80) acceptor shouldn't include 141=Y in logon responses
gbirchmeier Jun 8, 2015
c138736
Merge pull request #317 from gbirchmeier/80reset
gbirchmeier Jun 8, 2015
2b82403
get rid of unnecessary and inexplicable gitignore files
gbirchmeier Jun 8, 2015
42024f2
Merge pull request #318 from gbirchmeier/gitignore
gbirchmeier Jun 8, 2015
dd07716
don't include unneeded sessions in AT config files
gbirchmeier Jun 8, 2015
0d51ac7
Merge pull request #319 from gbirchmeier/atcfg
gbirchmeier Jun 8, 2015
fe57992
Revert "these should have been committed long ago"
gbirchmeier Jun 9, 2015
33dd7b0
Merge pull request #320 from gbirchmeier/badcommit
gbirchmeier Jun 9, 2015
74eba12
ignore a generated AT cfg
gbirchmeier Jun 9, 2015
b132023
Merge branch 'dynamic_sessions' of github.com:martinadams/quickfixn i…
gbirchmeier Jun 9, 2015
bb191ce
Merge branch 'master' into 314
gbirchmeier Jun 9, 2015
5d17cc3
typos and wording changes
gbirchmeier Jun 10, 2015
a8153fe
attribution for #314
gbirchmeier Jun 10, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add new Application Callback (non-breaking) for early intercept of in…
…bound messages.

Add an IApplicationExt interface that extends IApplication and facilitates early
intercept of inbound messages on the part of the Application.

This is a bit similar to the late outbound intercept afforded by ToApp/ToAdmin,
and permits alteration of field values prior to their being validated by the engine.
The difference is that, with the new interface, only one callback is provided for
both App and Admin messages.

Usage of the existing IApplication interface is unaffected.
  • Loading branch information
martinadams committed Nov 17, 2014
commit 4bc599bde671253f52348315967f316b44a7eb18
20 changes: 20 additions & 0 deletions QuickFIXn/IApplicationExt.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;

namespace QuickFix
{
/// <summary>
/// This is the optional extension interface for processing session messages, and facilitates early interception of inbound messages.
/// 'Early', in this context, means after structure, length and checksum have been validated, but before any further validation has been performed.
/// </summary>
public interface IApplicationExt : IApplication
{
/// <summary>
/// This callback provides early notification of when an administrative or application message is sent from a counterparty to your FIX engine.
/// This can be useful for doing pre-processing of an inbound message after its structure, checksum and length have been validated, but before
/// any further validation has been performed on it.
/// </summary>
/// <param name="message">received message</param>
/// <param name="sessionID">session on which message received</param>
void FromEarlyIntercept(Message message, SessionID sessionID);
}
}
3 changes: 2 additions & 1 deletion QuickFIXn/QuickFix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<Compile Include="FileStoreFactory.cs" />
<Compile Include="FixValues.cs" />
<Compile Include="IApplication.cs" />
<Compile Include="IApplicationExt.cs" />
<Compile Include="IInitiator.cs" />
<Compile Include="ILog.cs" />
<Compile Include="ILogFactory.cs" />
Expand Down Expand Up @@ -141,4 +142,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
5 changes: 5 additions & 0 deletions QuickFIXn/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class Session : IDisposable
private SessionSchedule schedule_;
private SessionState state_;
private IMessageFactory msgFactory_;
private bool appDoesEarlyIntercept_;
private static readonly HashSet<string> AdminMsgTypes = new HashSet<string>() { "0", "A", "1", "2", "3", "4", "5" };

#endregion
Expand Down Expand Up @@ -211,6 +212,7 @@ public Session(
this.DataDictionaryProvider = new DataDictionaryProvider(dataDictProvider);
this.schedule_ = sessionSchedule;
this.msgFactory_ = msgFactory;
appDoesEarlyIntercept_ = app is IApplicationExt;

this.SenderDefaultApplVerID = senderDefaultApplVerID;

Expand Down Expand Up @@ -547,6 +549,9 @@ public void Next(Message message)
return;
}

if (appDoesEarlyIntercept_)
((IApplicationExt)Application).FromEarlyIntercept(message, this.SessionID);

if (IsNewSession)
state_.Reset("New session (detected in Next(Message))");

Expand Down
74 changes: 73 additions & 1 deletion UnitTests/SessionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,49 @@ public void OnLogout(QuickFix.SessionID sessionID)
public void OnLogon(QuickFix.SessionID sessionID)
{
}
#endregion
}

class MockApplicationExt : QuickFix.IApplicationExt
{
public HashSet<string> InterceptedMessageTypes = new HashSet<string>();

#region Application Members

public void ToAdmin(QuickFix.Message message, QuickFix.SessionID sessionID)
{
}

public void FromAdmin(QuickFix.Message message, QuickFix.SessionID sessionID)
{
}

public void ToApp(QuickFix.Message message, QuickFix.SessionID sessionId)
{
}

public void FromApp(QuickFix.Message message, QuickFix.SessionID sessionID)
{
}

public void OnCreate(QuickFix.SessionID sessionID)
{
}

public void OnLogout(QuickFix.SessionID sessionID)
{
}

public void OnLogon(QuickFix.SessionID sessionID)
{
}

public void FromEarlyIntercept(QuickFix.Message message, QuickFix.SessionID sessionID)
{
InterceptedMessageTypes.Add(message.Header.GetString(QuickFix.Fields.Tags.MsgType));
}
#endregion

}

[TestFixture]
Expand All @@ -126,6 +167,7 @@ public class SessionTest
MockApplication application = null;
QuickFix.Session session = null;
QuickFix.Session session2 = null;
QuickFix.Dictionary config = null;
int seqNum = 1;
Regex msRegex = new Regex(@"\.[\d]{1,3}$");

Expand All @@ -137,7 +179,7 @@ public void setup()
application = new MockApplication();
settings = new QuickFix.SessionSettings();

QuickFix.Dictionary config = new QuickFix.Dictionary();
config = new QuickFix.Dictionary();
config.SetBool(QuickFix.SessionSettings.PERSIST_MESSAGES, false);
config.SetString(QuickFix.SessionSettings.CONNECTION_TYPE, "initiator");
config.SetString(QuickFix.SessionSettings.START_TIME, "00:00:00");
Expand Down Expand Up @@ -719,5 +761,35 @@ public void TestToAppResendDoNotSend()
SendResendRequest(1, 0);
Assert.False(SENT_NOS());
}


[Test]
public void TestApplicationExtension()
{
var mockApp = new MockApplicationExt();
session = new QuickFix.Session(mockApp, new QuickFix.MemoryStoreFactory(), sessionID,
new QuickFix.DataDictionaryProvider(), new QuickFix.SessionSchedule(config), 0, new QuickFix.ScreenLogFactory(settings), new QuickFix.DefaultMessageFactory(), "blah");
session.SetResponder(responder);
session.CheckLatency = false;

Logon();
QuickFix.FIX42.NewOrderSingle order = new QuickFix.FIX42.NewOrderSingle(
new QuickFix.Fields.ClOrdID("1"),
new QuickFix.Fields.HandlInst(QuickFix.Fields.HandlInst.MANUAL_ORDER),
new QuickFix.Fields.Symbol("IBM"),
new QuickFix.Fields.Side(QuickFix.Fields.Side.BUY),
new QuickFix.Fields.TransactTime(),
new QuickFix.Fields.OrdType(QuickFix.Fields.OrdType.LIMIT));

order.Header.SetField(new QuickFix.Fields.TargetCompID(sessionID.SenderCompID));
order.Header.SetField(new QuickFix.Fields.SenderCompID(sessionID.TargetCompID));
order.Header.SetField(new QuickFix.Fields.MsgSeqNum(2));

session.Next(order);

Assert.That(mockApp.InterceptedMessageTypes.Count, Is.EqualTo(2));
Assert.True(mockApp.InterceptedMessageTypes.Contains(QuickFix.Fields.MsgType.LOGON));
Assert.True(mockApp.InterceptedMessageTypes.Contains(QuickFix.Fields.MsgType.NEWORDERSINGLE));
}
}
}