Click or drag to resize

FixEngine

com.b2bits.FIXAntennaFixEngine is a core class that controls global parameters of FIXAntenna and creates Sessions.

This topic contains the following sections:

Note  Note

To compile the samples below please declare the usage of com.b2bits.FIXAntenna namespace

FixEngine Initilalization

Before you instantiate any objects from classes of com.b2bits.FIXAntenna namespace or call any static methods, you need to initialize FixEngine, i.e. tell the engine where it could find settings.

This is performed be means of the FixEngineCreate static method. Call this method in your application statup code.

More often developers use FixEngineCreate method overload to read the settings from file. Fix Engine settings files will be explained in detail in FixAntenna Configuration.

C#
using com.b2bits.FIXAntenna;

// initialization
FixEngine engine = FixEngine.Create("engine.properties");  

// ... - main functionality
VB
Imports com.b2bits.FIXAntenna

' initialization
Dim engine As FixEngine = FixEngine.Create("engine.properties")

' ... - main functionality
C++
using namespace com::b2bits::FIXAntenna;

// initialization
FixEngine^ engine = FixEngine::Create("engine.properties");  

// ... - main functionality
Getting an Instance of FixEngine

The FixEngine class, as well as some other FIXAntenna.Net API classes, implements the “Singleton” Design Pattern. Therefore, to access non-static methods of the class, first of all get the pointer to the class singular instance using the FixEngineInstance static property.

For example, sessions can be created with the following code (see Sessions for more details)

C#
FixEngine.Instance.CreateSession(...);
VB
FixEngine.Instance.CreateSession(...)
C++
FixEngine::Instance->CreateSession( ... );
Cleaning up
Note  Note

Very important: stop the engine before exiting the program!

C#
FixEngine.Instance.Stop();
VB
FixEngine.Instance.Stop()
C++
FixEngine::Instance->Stop();
Statistics

You can obtain information about current engine sessions using the FixEngineStatistics property.

C#
EngineStatistics statistics = FixEngine.Instance.Statistics;
Console.WriteLine(statistics);
VB
Dim statistics As EngineStatistics = FixEngine.Instance.Statistics
Console.WriteLine(statistics)
C++
EngineStatistics statistics = FixEngine::Instance->Statistics;
Console::WriteLine(statistics);
See Also