FIX Session Acceptor

Create

To create a session, call the following method:
Engine::Session* Engine::FixEngine::createSession(Engine::Application* apApp, const std::string& aSenderCompID, const std::string& aTargetCompID, 
    Engine::FIXVersion aVer = FIX42, Engine::SessionExtraParameters* pParam = NULL, const Engine::MessageStorageType storageType = persistent_storageType)

After session is created use void Engine::Session::connect() to connect it as acceptor.

For example:

#include <iostream>
#include <B2BITS_V12.h>
   
using namespace std;
   
class Appl : public Engine::Application {
// See "Application description" section
};

try {
    // initialization
    Engine::FixEngine::init(); 
   
    Appl appl; 

    // create a session for FIX 4.2
    Engine::Session* pSn = Engine::FixEngine::singleton()->createSession(
        &appl, "SENDER", "TARGET", Engine::FIX42); 
   
    // establish the session as Acceptor
    pSn->connect();
   
    // ... - business logic 
 
    // terminate the FIX session
    pSn->disconnect(); 
   
    // it is vital to do this before the 'release' call
    pSn->registerApplication(NULL);    
    
    // release resources
    pSn->release(); 
    FixEngine::destroy(); 
} catch(const Exception& ex) {
    cout << "EXCEPTION: " << ex.what() << endl;
}

Unregistered acceptors

FIX Antenna automatically creates session acceptor when logon message is received and corresponding pre-created session acceptor is not found. There are two ways to control this behavior:

Reconnect

According to the FIX protocol standard it is not acceptor's responsibility to reconnect. When connection is unexpectedly terminated acceptor is moved to "Wait for logon" state persisting its state. When correct logon is received acceptor completes reconnection process and continue works from exactly where it was before termination.

Disconnect

To disconnect acceptor (process can be also called "terminate", "delete", "close") the following methods can be used:

aMarkAsTerminated parameter is used to set the desired state after disconnection. If it is set to "true" acceptor tries to disconnect gracefully (i.e. execute logout procedure). If it is set to "false" accettor moves to the non-gracefully terminated state.

Release

To release a session's resources the Engine::Session::release() method is used.

It is vital to call Engine::Session::registerApplication(NULL) before calling the release method.

It is vital to call the Engine::Session::release() method only once for the given session.

Send message

To send outgoing application-level messages, use the Engine::Session::put(Engine::FIXMessage *) method.

All session level messages are send automatically when needed.


Generated on Fri Apr 17 12:26:09 2009 for B2BITS FIX Antenna C++ by  doxygen 1.5.6