B2BITS FIX Antenna C++  2.27.0
Remote administration

Table of Contents

Description

FIX Antenna provides access to embedded monitoring and administrative functionality by means of usual FIX sessions with special TargetCompID. All sessions with TargetCompID equal to FIXADMIN are treated as service sessions and have exclusive processing. FIX XML message (MsgType = n) is used to transport commands or execution results in XML form. MonitoringRequestId tag (9207) is included in XML message to identify a command. This tag is returned in response, so several commands can be sent in consecutive order.

You can enable monitoring functionality by setting the Monitoring.enable parameter to 'true' value and defining the necessary administrative session parameters. If monitoring is disabled, sessions with TargetCompID equal to FIXADMIN are processed as usual.

Monitoring requires FIX protocol customization of the XML(n) message in the following way:

<fixdic fixversion="4.4" id="FIX44" title="FA Monitoring FIX 4.4" date="2008/05/12">
<fielddic>
<fielddef tag="9207" name="MonitoringRequestId" type="String"/>
</fielddic>
<msgdic>
<msgdef msgtype="n">
<field tag="9207" req="N"/>
</msgdef>
</msgdic>
</fixdic>

Note the example is for FIX 4.4. If other version of protocol is used it should be customized as well the way shown in this example.

Supported commands

Monitoring and administrative commands as well as execution results are transported using FIX XML message (MsgType = n). XML Schema of command requests and responses is defined in FAMonitoring.xsd document.

SessionsList - get list of sessions

Example of request:

<SessionsList />

Example of response:

<Response ResultCode="0">
<SessionsListData>
<Session>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
</Session>
<Session>
<SenderCompID>TROIOI</SenderCompID>
<TargetCompID>AUTEX</TargetCompID>
</Session>
</SessionsListData>
</Response>

SessionStat - get detailed information about session

Example of request:

<SessionStat>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
</SessionStat>

Example of response:

<Response ResultCode="0">
<SessionStatData>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
<ReceivedBytes>5107901</ReceivedBytes>
<SentBytes>6445854</SentBytes>
<ReceivedMessages>25539</ReceivedMessages>
<SentMessages>32229</SentMessages>
<ReceivedHandlingTime>5782453</ReceivedHandlingTime>
<SentHandlingTime>7143127</SentHandlingTime>
<Established>2008-05-13T07:55:23</Established>
<TerminatedNormal>2008-05-13T07:51:34</TerminatedNormal>
<TerminatedAbnormal>2008-05-10T15:43:11</TerminatedAbnormal>
<DurationSum>94734720</DurationSum>
<LastReceivedMessage>2008-05-13T18:21:10</LastReceivedMessage>
<LastSentMessage>2008-05-13T18:21:10</LastSentMessage>
<SessionStatData>
</Response>

SessionStatus - get status of session

Example of request:

<SessionStatus>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
</SessionStatus>

Example of response:

<Response ResultCode="0">
<SessionStatusData>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
<Status>WaitForConfirmLogout</Status>
</SessionStatusData>
</Response>

GeneralSessionsStat - get statistical information about the current state of FIX Antenna

Example of request:

<GeneralSessionsStat />

Example of response:

<Response ResultCode="0">
<GeneralSessionsStatData>
<ActiveSessions>2</ActiveSessions>
<ReconnectingSessions>1</ReconnectingSessions>
<AwaitingSessions>0</AwaitingSessions>
<TerminatedNormalSessions>32</TerminatedNormalSessions>
<TerminatedAbnormalSessions>5</TerminatedAbnormalSessions>
</GeneralSessionsStatData>
</Response>

AverageReceivedStat - get average handling time for received messages

Example of request:

<AverageReceivedStat>
<Version>FIX42</Version>
<Type>D</Type>
</AverageReceivedStat>

Example of response:

<Response ResultCode="0">
<AverageReceivedStatData>
<Version>FIX42</Version>
<Type>D</Type>
<AverageTime>226</AverageTime>
</AverageReceivedStatData>
</Response>

AverageSentStat - get average handling time for sent messages

Example of request:

<AverageSentStat>
<Version>FIX42</Version>
<Type>8</Type>
</AverageSentStat>

Example of response:

<Response ResultCode="0">
<AverageSentStatData>
<Version>FIX42</Version>
<Type>8</Type>
<AverageTime>221</AverageTime>
</AverageSentStatData>
</Response>

AverageValidateStat - get average validation time for messages

Example of request:

<AverageValidateStat>
<Version>FIX42</Version>
<Type>8</Type>
</AverageValidateStat>

Example of response:

<Response ResultCode="0">
<AverageValidateStatData>
<Version>FIX42</Version>
<Type>8</Type>
<AverageTime>142</AverageTime>
</AverageValidateStatData>
</Response>

ReceivedStat - get received message amount

Example of request:

<ReceivedStat />

Example of response:

<Response ResultCode="0">
<ReceivedStatData>
<ReceivedMessages>76617</ReceivedMessages>
</ReceivedStatData>
</Response>

SentStat - get sent message amount

Example of request:

<SentStat />

Example of response:

<Response ResultCode="0">
<SentStatData>
<SentMessages>96687</SentMessages>
</SentStatData>
</Response>

ProceedStat - get proceed message amount

Example of request:

<ProceedStat />

Example of response:

<Response ResultCode="0">
<ProceedStatData>
<ProceedMessages>173304</ProceedMessages>
</ProceedStatData>
</Response>

CreateAcceptor - creates FIX session as acceptor

Example of request:

<CreateAcceptor>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
<Version>FIX44</Version>
</CreateAcceptor>

Example of response:

<Response ResultCode="0"/>

Delete - deletes FIX session

Example of request:

<Delete>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
<SendLogout>true</SendLogout>
<LogoutReason>Evacuation</LogoutReason>
</Delete>

Example of response:

<Response ResultCode="0"/>

As Delete is asynchronous command, successful result means that execution is started, but there is no guarantee of its successful finish.

ToBackup - switches FIX session to backup connection

Example of request:

<ToBackup>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
</ToBackup>
Example of response:
\code
<Response ResultCode="3">
<Description>Unknown session</Description>
</Response>

ChangeSeqNum - changes session sequence number

Example of request:

<ChangeSeqNum>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
<InSeqNum>100</InSeqNum>
<OutSeqNum>100</OutSeqNum>
</ChangeSeqNum>

Example of response:

<Response ResultCode="0"/>

ResetSeqNum - resets session sequence number (force seqnum reset logon)

Example of request:

<ResetSeqNum>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
</ResetSeqNum>

Example of response:

<Response ResultCode="0"/>

TestRequest - sends Test Request message to session

Example of request:

<TestRequest>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
<TestReqID>12345576</TestReqID>
</TestRequest>

Example of response:

<Response ResultCode="0"/>

Heartbeat - sends Heartbeat message to session

Example of request:

<Heartbeat>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
</Heartbeat>

Example of response:

<Response ResultCode="0"/>

SendMessage - sends message to session

Example of request (FIX Message is base64 encoded):

<SendMessage>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
<Message>OD1GSVguNC40ATk9NDcBMzU9MAE0OT1PUFNYATU2PVNEU0kBMzQ9MgE1Mj0yMDA3MDkyMC0xNTowOTowOQExMD0xNDUB</Message>
</SendMessage>

Example of response:

<Response ResultCode="0"/>

DeleteAll - deletes all FIX sessions

Example of request:

<DeleteAll>
<SendLogout>true</SendLogout>
<LogoutReason>Evacuation</LogoutReason>
</DeleteAll>

Example of response:

<Response ResultCode="0">
<DeleteAllData>
<Deleted>4</Deleted>
<Failed>
<Session>
<SenderCompID>TestSender</SenderCompID>
<TargetCompID>TestTarget</TargetCompID>
<Description>Access denied</Description>
</Session>
</Failed>
</DeleteAllData>
</Response>

As DeleteAll is asynchronous command, successful result means that execution is started, but there is no guarantee of its successful finish.

Help - get list of supported commands

Example of request:

<Help />

Example of response:

<Response ResultCode="0">
<HelpData>
<DeleteAll>
<Description>deletes all FIX sessions</Description>
<Parameter>
<Name>SendLogout</Name>
<Description>flag defines wheter logout must be sent</Description>
<IsRequired>false</IsRequired>
<DefaultValue>true</DefaultValue>
<Value>true</Value><Value>false</Value>
</Parameter>
<Parameter>
<Name>LogoutReason</Name>
<Description>disconnect reason</Description>
<IsRequired>false</IsRequired>
</Parameter>
</DeleteAll>
<Help>
<Description>get list of supported commands</Description>
</Help>
</HelpData>
</Response>

Creating administrative session

Administrative session will be created automatically, if the user creates a FIX session with TargetCompID equal to 'FIXADMIN' and connects it to Fix Antenna. After connection is established FIX XML(n) messages with administrative commands can be sent to FIX Antenna.

Implementing custom administrative commands

The user is allowed to customize Fix Antenna monitoring: add new administrative commands, use another kind of FIX messages, etc. To extend the basic monitoring functionality it's required to inherit the user class from AdminApplication base class and override the AdminApplication::process(const std::string&, const DOMNode*, const Context&) method. The description of supported commands can be updated by the overriden AdminApplication::getAvailableCommands method. Messages different from the FIX XML message can be processed by the overriden AdminApplication::process(const FIXMessage&, const Session&) method.

class CustomAdmin : public Engine::AdminApplication{
public:
virtual bool process(const std::string& action, const DOMNode* element, const Context& context){
if (action == "ImplementationVersion") {
sendResponse("<?xml version=\"1.0\"?><Response ResultCode=\"0\">"
"<ImplementationVersionData>" + strVERSION + "</ImplementationVersionData></Response>", context);
return true;
}
return AdminApplication::process(action, element, context);
}
virtual void getAvailableCommands(AdminApplication::CommandTable* commands) const {
(*commands)["ImplementationVersion"] =
"<ImplementationVersion>"
"<Description>get version of server implementation</Description>"
"</ImplementationVersion>";
}
};

Registering custom administrative application

Fix Antenna will use the derived class only after calling the FixEngine::registerAdminApplication method:

CustomAdmin adminApp;
FixEngine::singleton()->registerAdminApplication(&adminApp);
// ... - business logic
FixEngine::singleton()->registerAdminApplication(NULL);