Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Install FIX Antenna Java™
  2. Update your project to include FIX Antenna libraries
  3. Convert QuickFIX/J configuration files into FIX Antenna Java™ format
  4. Update your project to replace QuickFIX/J API with FIX Antenna API
  5. Optional. Convert the dictionaries into FIXDIC format
  6. Compile and run

 


1. Install FIX Antenna Java™

...

3. Convert QuickFIX/J configuration files into FIX Antenna Java™ format

QuickFIX/J

FIX Antenna Java

1
Code Block
2
language
3
java
4
linenumbers
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 
 [default]
true
              	
[default]
FileStorePath=target/data/app


HeartBtInt=30


BeginString=FIX.4.4


StartTime=00:00:00


EndTime=00:00:00

 

 
[session]


ConnectionType=initiator


SocketConnectHost=localhost


SocketConnectPort=9876


SenderCompID=BANZAI


TargetCompID=EXEC


ReconnectInterval=5

 
 
 

 
 
 
[session]


ConnectionType=acceptor


SenderCompID=EXEC


TargetCompID=BANZAI


SocketAcceptPort=9880
1
Code Block
2
language
3
java
4
theme
5
Eclipse
6
linenumbers
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24sessionIDs=initiatorS, acceptorS
 
#Default session parameters
sessions
true
sessionIDs=initiatorS, acceptorS
 
#Default session parameters
sessions.default.storageDirectory=target/data/app


sessions.default.heartbeatInterval=30


sessions.default.fixVersion=FIX.4.4

 
 
 
## Session initiatorS



## Session initiatorS
sessions.initiatorS.sessionType=initiator


sessions.initiatorS.host=localhost


sessions.initiatorS.port=9876


sessions.initiatorS.senderCompID=BANZAI


sessions.initiatorS.targetCompID=EXEC


//0 - infinitive autoreconnect


sessions.initiatorS.autoreconnectAttempts=0


sessions.initiatorS.autoreconnectDelayInMs=5000

 
## Session acceptorS

 
## Session acceptorS
sessions.acceptorS.sessionType=acceptor


sessions.acceptorS.senderCompID=EXEC


sessions.acceptorS.targetCompID=BANZAI
	
 

44. Update your project to replace QuickFIX/J API with FIX Antenna API

4.1. Session configuration and start - Acceptor

QuickFIX/J

FIX Antenna Java

1
Code Block
2
language
3
java
4// preventing application from exiting
        
linenumbers
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60import quickfix.*;
import java.io.FileInputStream;
 
public class QFJApp {
 
    public static void main(String args[]) throws Exception {
        if (args.length != 1) {
            return;
        }
        // path to file with session's configuration
        String fileName = args[0];
 
        // FooApplication is your class that implements the Application interface
        Application application = new FooApplication();
 
        SessionSettings settings = new SessionSettings(new FileInputStream(fileName));
        MessageStoreFactory storeFactory = new FileStoreFactory(settings);
        MessageFactory messageFactory = new DefaultMessageFactory();
        // start acceptor
        Acceptor acceptor =
                new SocketAcceptor(application, storeFactory, settings, messageFactory);
        acceptor.start();
 
        
true
import quickfix.*;
import java.io.FileInputStream;
 
public class QFJApp {
 
    public static void main(String args[]) throws Exception {
        if (args.length != 1) {
            return;
        }
        // path to file with session's configuration
        String fileName = args[0];
 
        // FooApplication is your class that implements the Application interface
        Application application = new FooApplication();
 
        SessionSettings settings = new SessionSettings(new FileInputStream(fileName));
        MessageStoreFactory storeFactory = new FileStoreFactory(settings);
        MessageFactory messageFactory = new DefaultMessageFactory();
        // start acceptor
        Acceptor acceptor =
                new SocketAcceptor(application, storeFactory, settings, messageFactory);
        acceptor.start();
 
        // preventing application from exiting
        System.out.println("Press enter to exit");

        

        System.in.read();

        

        acceptor.stop();

    }

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

import com.epam.fix.message.FIXFieldList;
import com.epam.fixengine.*;
import com.epam.fixengine.acceptor.DenyNonRegisteredAcceptorStrategyHandler;
import com.epam.fixengine.configuration.Configuration;
 
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
 
// implements FIXServerListener to get notifications about new connections
public class SimpleAcceptorServer implements FIXServerListener {
 
    // all active sessions should have references or will be GCed
    private List<FIXSession> activeSessions = new ArrayList<FIXSession>();
 
    public static void main(String[] args) throws IOException {
        if (args.length != 1) {
            return;
        }
        String fileName = args[0];
 
        // enable server strategy for accepting only registered sessions
        Configuration globalServerConfig = Configuration.getGlobalConfiguration();
        globalServerConfig.setProperty(Configuration.SERVER_ACCEPTOR_STRATEGY,
                

    }
}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 	
Code Block
languagejava
linenumberstrue
import com.epam.fix.message.FIXFieldList;
import com.epam.fixengine.*;
import com.epam.fixengine.acceptor.DenyNonRegisteredAcceptorStrategyHandler;
import com.epam.fixengine.configuration.Configuration;
 
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
 
// implements FIXServerListener to get notifications about new connections
public class SimpleAcceptorServer implements FIXServerListener {
 
    // all active sessions should have references or will be GCed
    private List<FIXSession> activeSessions = new ArrayList<FIXSession>();
 
    public static void main(String[] args) throws IOException {
        if (args.length != 1) {
            return;
        }
        String fileName = args[0];
 
        // enable server strategy for accepting only registered sessions
        Configuration globalServerConfig = Configuration.getGlobalConfiguration();
        globalServerConfig.setProperty(Configuration.SERVER_ACCEPTOR_STRATEGY,
                DenyNonRegisteredAcceptorStrategyHandler.class.getCanonicalName());

 
        

 
        // create server that will listen for TCP/IP
connections
        FIXServer server = new 
 connections
        FIXServer server = new FIXServer();

        

        server.setPort(9880);

        

        // setting listener for new
connections
        
 connections
        server.setListener(new
 
 SimpleAcceptorServer());

        // setting path to properties file with sessions
        

        // setting path to properties file with sessions
        server.setConfigPath(fileName);

 
        

 
        // starting new thread and listen for incoming
connections
        
 connections
        server.start();

 
        

 
        // preventing application from
exiting
        
 exiting
        System.out.println("Press enter to exit");

        

        System.in.read();

        

        // stop the thread that listens for new
connections
        
 connections
        server.stop();

    }
 
    // this method is called for every new connection
    public void newFIXSession(FIXSession session) {
        try {
            

    }
 
    // this method is called for every new connection
    public void newFIXSession(FIXSession session) {
        try {
            activeSessions.add(session);

 
            

 
            // setting listener for incoming messages;

            

            // MyFIXSessionListener is is your class that
implements
            
 implements
            // the FIXSessionListener
interface
            
 interface
            session.setFIXSessionListener(new
 
 MyFIXSessionListener(session));

 
            

 
            // accept incoming
session
            
 session
            session.connect();

        catch (IOException e) {
        }
    }

        } catch (IOException e) {
        }
    }
}
4.2. Session configuration and start - Initiator

QuickFIX/J

FIX Antenna Java

1
Code Block
2
language
3
java
4
        
linenumbers
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39import quickfix.*;
import java.io.FileInputStream;
 
public class QFJInitiator {
    public static void main(String args[]) throws Exception {
        if (args.length != 1return;
        // path to file with session's configuration
        String fileName = args[0];
 
        // FooApplication is your class that implements the Application interface
        Application application = new FooApplication();
 
        SessionSettings settings = new SessionSettings(new FileInputStream(fileName));
        MessageStoreFactory storeFactory = new FileStoreFactory(settings);
        MessageFactory messageFactory = new DefaultMessageFactory();
        Initiator initiator =
                new SocketInitiator(application, storeFactory, settings, messageFactory);
        initiator.start();
        // preventing application from exiting
true
import quickfix.*;
import java.io.FileInputStream;
 
public class QFJInitiator {
    public static void main(String args[]) throws Exception {
        if (args.length != 1) return;
        // path to file with session's configuration
        String fileName = args[0];
 
        // FooApplication is your class that implements the Application interface
        Application application = new FooApplication();
 
        SessionSettings settings = new SessionSettings(new FileInputStream(fileName));
        MessageStoreFactory storeFactory = new FileStoreFactory(settings);
        MessageFactory messageFactory = new DefaultMessageFactory();
        Initiator initiator =
                new SocketInitiator(application, storeFactory, settings, messageFactory);
        initiator.start();
        // preventing application from exiting
        System.out.println("Press enter to exit");

        

        System.in.read();

 
        

 
        initiator.stop();

    }
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

import 

    }
}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
Code Block
languagejava
linenumberstrue
import com.epam.fix.message.FIXFieldList;
import com.epam.fix.message.
FIXFieldList;
import com.epam.fix.message.
constants.FIXT11;


import
 
 com.epam.fixengine.*;


import
 
 com.epam.fixengine.session.util.SessionParametersBuilder;

 
import 

 
import java.io.IOException;

 
public class SimpleInitiator {
    public static void 

 
public class SimpleInitiator {
    public static void main(String[] args)
 
 throws
 
 IOException
{
        if 
 {
        if (args.length !=
 
 1)
{
            return;
        }
        String configFile =
 {
            return;
        }
        String configFile = args[0];

 
        

 
        //load initiator
configuration
        SessionParameters details =
            
 configuration
        SessionParameters details =
            SessionParametersBuilder.buildSessionParameters(configFile,
 
 "initiatorS");

 
        

 
        // create session we intend to work
with
        final FIXSession session =
 with
        final FIXSession session = details.createNewFIXSession();

 
        

 
        // setting listener for incoming messages;

        

        // MyFIXSessionListener is is your class that
implements
        // the FIXSessionListener interface
        
 implements
        // the FIXSessionListener interface
        session.setFIXSessionListener(new
 
 MyFIXSessionListener(session));

 
        

 
        // initiate
connection
        try {
            
 connection
        try {
            session.connect();

        catch (IOException e) {
        }
 
        // preventing application from exiting
        

        } catch (IOException e) {
        }
 
        // preventing application from exiting
        System.out.println("Press enter to exit");

        

        System.in.read();

        

        // stop the thread that listens for new
connections
        session
 connections
        session.disconnect("user request");

    }

    }
}
4.3. Compose message: flat model

QuickFIX/J

FIX Antenna Java

1
Code Block
2
language
3
java
4Message message = new 
linenumbers
5
6
7
8
9
10
11
12
13
14
true
Message message = new Message();

  

  // BeginString

  

  message.getHeader().setField(new
 
 StringField(8,
 
 "FIX.4.2"));

  

  // SenderCompID

  

  message.getHeader().setField(new
 
 StringField(49,
 
 "TW"));

  

  // TargetCompID

  

  message.getHeader().setField(new
 
 StringField(56,
 
 "TARGET"));

  

  // MsgType

  

  message.getHeader().setField(new
 
 CharField(35,
 
 'F'));

  

  // ClOrdID

  

  message.setField(new
 
 StringField(11,
 
 "321"));

  

  // Side, with value enumeration

  

  message.setField(new
 
 CharField(54, Side.BUY)));

  

  // ... and other fields as necessary ...
1
Code Block
2
language
3
java
4
linenumbers
5
6
7
8
9
10
11
12
13
14FIXFieldList messageContent = new 
true
FIXFieldList messageContent = new FIXFieldList();

 

 // BeginString

  

  messageContent.addTag(8,
 
 "FIX.4.2");

  

  // SenderCompID

  

  messageContent.addTag(49,
 
 "TW");

  

  // TargetCompID

  

  messageContent.addTag(56,
 
 "TARGET");

  

  // MsgType

  

  messageContent.addTag(35,
 
 "F");

  

  // ClOrdID

  

  message.addTag(11,
 
 "321");

  

  // Side

  

  message.addTag(54, Side.BUY.getValue());

  

  // ... and other fields as necessary ...
4.4. Compose message: object model (not recomened for FIXAJ due to low perfomance)

QuickFIX/J

FIX Antenna Java

1
Code Block
2
language
3
java
4
linenumbers
5
true
6
quickfix.fix42.ExecutionReport message
=
    new 
 =
    new quickfix.fix42.ExecutionReport
(
        new 
 (
        new ClOrdID("321"),

        new 

        new ExecType("1"),

        new 

        new OrdStatus("2"),

        new 

        new LeavesQty(0.0));
1
Code Block
2
language
3
java
4
linenumbers
5
true
6
// Create an "Execution Report" message for FIX 4.2


ExecutionReport exec =
 
 new
 
 ExecutionReport();


exec.setClOrdID("321");


exec.setExecType('1');


exec.setOrdStatus('2');


exec.setLeavesQty(0.0);
4.5. Create message with repeating groups

QuickFIX/J

FIX Antenna Java

1
Code Block
2
language
3
java
4public void createRG(){
    
linenumbers
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
true
public void createRG(){
    quickfix.fix42.MarketDataSnapshotFullRefresh message
=
            new 
 =
            new quickfix.fix42.MarketDataSnapshotFullRefresh(new
 
 Symbol("QF"));

 
    

 
    quickfix.fix42.MarketDataSnapshotFullRefresh.NoMDEntries group
=
            new 
 =
            new quickfix.fix42.MarketDataSnapshotFullRefresh.NoMDEntries();

 
    

 
    group.set(new
 
 MDEntryType('0'));

    

    group.set(new
 
 MDEntryPx(12.32));

    

    group.set(new
 
 MDEntrySize(100));

    

    group.set(new
 
 OrderID("ORDERID"));

    

    message.addGroup(group);

 
    

 
    group.set(new
 
 MDEntryType('1'));

    

    group.set(new
 
 MDEntryPx(12.32));

    

    group.set(new
 
 MDEntrySize(100));

    

    group.set(new
 
 OrderID("ORDERID"));

    

    message.addGroup(group);

}
 
 
 
 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

public void createRG(){
    FIXFieldList message = FIXFieldListFactory.newInstanceFromPool();
    

}
	
	
	
	
Code Block
languagejava
linenumberstrue
public void createRG(){
    FIXFieldList message = FIXFieldListFactory.newInstanceFromPool();
    message.addTag(Symbol,
 
 "QF");

 
     
RepeatingGroup group =

 
     
RepeatingGroup group = message.addRepeatingGroup(NoMDEntries);

    

    RepeatingGroup.Entry entry1 = group.addEntry();

    

    entry1.addTag(MDEntryType,
 
 '0');

    

    entry1.addTag(MDEntryPx,
 
 12.32,
 
 2);

    

    entry1.addTag(MDEntrySize,
 
 100);

    

    entry1.addTag(OrderID,
 
 "ORDERID");

 
    

 
    RepeatingGroup.Entry entry2 = group.addEntry();

    

    entry2.addTag(MDEntryType,
 
 '1');

    

    entry2.addTag(MDEntryPx,
 
 12.32,
 
 2);

    

    entry2.addTag(MDEntrySize,
 
 100);

    

    entry2.addTag(OrderID,
 
 "ORDERID");

 
    

 
    //return objects to
pool
    
 pool
    entry1.release();

    

    entry2.release();

    

    group.release();


}
4.6. Reading message with repeating group

QuickFIX/J

FIX Antenna Java

1
Code Block
2
language
3
java
4public void 
linenumbers
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
true
public void processRG(quickfix.fix42.MarketDataSnapshotFullRefresh message)
 
 throws
 
 FieldNotFound
{
    NoMDEntries noMDEntries = new 
 {
    NoMDEntries noMDEntries = new NoMDEntries();

    

    message.get(noMDEntries);

    

    quickfix.fix42.MarketDataSnapshotFullRefresh.NoMDEntries group
=
            new 
 =
            new quickfix.fix42.MarketDataSnapshotFullRefresh.NoMDEntries();

    MDEntryType MDEntryType = new 

    MDEntryType MDEntryType = new MDEntryType();

    MDEntryPx MDEntryPx = new 

    MDEntryPx MDEntryPx = new MDEntryPx();

    MDEntrySize MDEntrySize = new 

    MDEntrySize MDEntrySize = new MDEntrySize();

    OrderID orderID = new 

    OrderID orderID = new OrderID();

 
    

 
    message.getGroup(1, group);

    

    group.get(MDEntryType);

    

    group.get(MDEntryPx);

    

    group.get(MDEntrySize);

    

    group.get(orderID);

 
    

 
    message.getGroup(2, group);

    

    group.get(MDEntryType);

    

    group.get(MDEntryPx);

    

    group.get(MDEntrySize);


}
1
Code Block
2
language
3
java
4
linenumbers
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21public void 
true
public void processRG(FIXFieldList message)
{
    RepeatingGroup group =
 {
    RepeatingGroup group = message.getRepeatingGroup(NoMDEntries);

 
    

 
    RepeatingGroup.Entry entry = group.getEntry(0);

    byte mdEntryType =

    byte mdEntryType = entry.getTagValueAsByte(MDEntryType);

    double mdEntryPx =

    double mdEntryPx = entry.getTagValueAsDouble(MDEntryPx);

    long mdEntrySize =

    long mdEntrySize = entry.getTagValueAsLong(MDEntrySize);

    String orderId =

    String orderId = entry.getTagValueAsString(OrderID);

 
    entry =

 
    entry = group.getEntry(1);

    mdEntryType =

    mdEntryType = entry.getTagValueAsByte(MDEntryType);

    mdEntryPx =

    mdEntryPx = entry.getTagValueAsDouble(MDEntryPx);

    mdEntrySize =

    mdEntrySize = entry.getTagValueAsLong(MDEntrySize);

    orderId =

    orderId = entry.getTagValueAsString(OrderID);

}
 
 
 
 
 
 

}
	
	
	
	
	
	
4.7. Sending message

QuickFIX/J

FIX Antenna Java

1
Code Block
2
language
3
java
4
linenumbers
5
6
7
8
9
10
11void 
true
void sendOrderCancelRequest()
 
 throws
 
 SessionNotFound
{
    
 {
    quickfix.fix41.OrderCancelRequest message
=
        new 
 =
        new quickfix.fix41.OrderCancelRequest(

            new 

            new OrigClOrdID("123"),

            new 

            new ClOrdID("321"),

            new 

            new Symbol("LNUX"),

            new 

            new Side(Side.BUY));

    

    message.set(new
 
 Text("Cancel My Order!"));

 
    

 
    Session.sendToTarget(message,
 
 "TW",
 
 "TARGET");


}
1
Code Block
2
language
3
java
4
linenumbers
5
6
7
8
9
10
11void 
true
void sendOrderCancelRequest(FIXSession session)
  {
    FIXFieldList message =
  {
    FIXFieldList message = FIXFieldListFactory.newInstanceFromPool();

     
    

     
    message.addTag(OrigClOrdID,
 
 "123");

    message

    message.addTag(ClOrdID,
 
 "321");

    

    message.addTag(Symbol,
 
 "LNUX");

    

    message.addTag(Side, BUY.getValue());

    

    message.addTag(Text,
 
 "Cancel My Order!");

 
    

 
    session.sendMessage("F", message);


}
4.8. Receiving and cracking message

QuickFIX/J

FIX Antenna Java

1
Code Block
2
language
3
java
4
linenumbers
5
6
7
8
9
10private static class FooApplication implements Application {
    
true
private static class FooApplication implements Application {
    //... other
methods
 
    
 methods
 
    // here you can process incomming
messages
    public void 
 messages
    public void fromApp(Message message, SessionID sessionID)

      throws 

      throws FieldNotFound, UnsupportedMessageType, IncorrectTagValue
{
        StringField field = new 
 {
        StringField field = new StringField(55);

        

        message.getField(field);

    }

1
2
3
4
5
6
7
8
9

class MyFIXSessionListener implements FIXSessionListener {
    

    }
} 
Code Block
languagejava
linenumberstrue
class MyFIXSessionListener implements FIXSessionListener {
    //... other
methods
    
 methods
    // here you can process incoming
messages
    public void 
 messages
    public void onNewMessage(FIXFieldList message)
{
        String symbol =
 {
        String symbol = message.getTagValueAsString(55);

        

        // or other getTagValueAsXXX()
methods
    }
}
 
 methods
    }
}
	
	
4.9. Minimal sample

QuickFIX/J

FIX Antenna Java

1
Code Block
2
language
3
java
4String fileName = args[0];
 
        // FooApplication is your class that implements the Application interface
        Application application = new FooApplication();
 
        SessionSettings settings = new SessionSettings(new FileInputStream(fileName));
        MessageStoreFactory storeFactory = new FileStoreFactory(settings);
        MessageFactory messageFactory = new DefaultMessageFactory();
        // start acceptor
        Acceptor acceptor =
                new SocketAcceptor(application, storeFactory, settings, messageFactory);
        acceptor.start();
 
        // preventing application from exiting
        
linenumbers
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85import quickfix.*;
import java.io.FileInputStream;
 
public class QFJApp {
 
    public static void main(String args[]) throws Exception {
        if (args.length != 1) {
            return;
        }
        // path to file with session's configuration
        
true
import quickfix.*;
import java.io.FileInputStream;
 
public class QFJApp {
 
    public static void main(String args[]) throws Exception {
        if (args.length != 1) {
            return;
        }
        // path to file with session's configuration
        String fileName = args[0];
 
        // FooApplication is your class that implements the Application interface
        Application application = new FooApplication();
 
        SessionSettings settings = new SessionSettings(new FileInputStream(fileName));
        MessageStoreFactory storeFactory = new FileStoreFactory(settings);
        MessageFactory messageFactory = new DefaultMessageFactory();
        // start acceptor
        Acceptor acceptor =
                new SocketAcceptor(application, storeFactory, settings, messageFactory);
        acceptor.start();
 
        // preventing application from exiting
        System.out.println("Press enter to exit");

        

        System.in.read();

 
        

 
        acceptor.stop();

    }
 
    private static class FooApplication implements Application {
        public void onCreate(SessionID sessionId) {}
        public void onLogon(SessionID sessionId) {}
        public void onLogout(SessionID sessionId) {}
        public void toAdmin(Message message, SessionID sessionId) {}
        public void toApp(Message message, SessionID sessionId) throws DoNotSend {}
        public void fromAdmin(Message message, SessionID sessionId)
                throws FieldNotFound, IncorrectDataFormat,
                IncorrectTagValue, RejectLogon {}
        public void fromApp(Message message, SessionID sessionId)
                throws FieldNotFound, IncorrectDataFormat,
                IncorrectTagValue, UnsupportedMessageType {
            System.out.println("New message is accepted: " + message.toString());
        }
    }
 
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

import 

    }
 
    private static class FooApplication implements Application {
        public void onCreate(SessionID sessionId) {}
        public void onLogon(SessionID sessionId) {}
        public void onLogout(SessionID sessionId) {}
        public void toAdmin(Message message, SessionID sessionId) {}
        public void toApp(Message message, SessionID sessionId) throws DoNotSend {}
        public void fromAdmin(Message message, SessionID sessionId)
                throws FieldNotFound, IncorrectDataFormat,
                IncorrectTagValue, RejectLogon {}
        public void fromApp(Message message, SessionID sessionId)
                throws FieldNotFound, IncorrectDataFormat,
                IncorrectTagValue, UnsupportedMessageType {
            System.out.println("New message is accepted: " + message.toString());
        }
    }
 
}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
Code Block
languagejava
linenumberstrue
import com.epam.fix.message.FIXFieldList;


import
 
 com.epam.fixengine.*;


import
 
 com.epam.fixengine.acceptor.DenyNonRegisteredAcceptorStrategyHandler;


import
 
 com.epam.fixengine.configuration.Configuration;

 
import 

 
import java.io.IOException;


import
 
 java.util.ArrayList;


import
 
 java.util.List;

 
 

 
 
// implements FIXServerListener to get notifications about new connections


public
 class SimpleAcceptorServer implements FIXServerListener {
 
    // all active sessions should have references or will be GCed
    private List<FIXSession> activeSessions = new ArrayList<FIXSession>();
 
    public static void 
 class SimpleAcceptorServer implements FIXServerListener {
 
    // all active sessions should have references or will be GCed
    private List<FIXSession> activeSessions = new ArrayList<FIXSession>();
 
    public static void main(String[] args)
 
 throws
 
 IOException
{
        if 
 {
        if (args.length !=
 
 1)
{
            return;
        }
        String fileName =
 {
            return;
        }
        String fileName = args[0];

 
        

 
        // enable server strategy for accepting only registered
sessions
        Configuration globalServerConfig =
 sessions
        Configuration globalServerConfig = Configuration.getGlobalConfiguration();

        

        globalServerConfig.setProperty(Configuration.SERVER_ACCEPTOR_STRATEGY,

                

                DenyNonRegisteredAcceptorStrategyHandler.class.getCanonicalName())
;
 
        
;
 
        // create server that will listen for TCP/IP
connections
        FIXServer server = new 
 connections
        FIXServer server = new FIXServer();

        

        server.setPort(9880);

        

        // setting listener for new
connections
        
 connections
        server.setListener(new
 
 SimpleAcceptorServer())
;
        
;
        // setting path to properties file with
sessions
        
 sessions
        server.setConfigPath(fileName);

 
        

 
        // starting new thread and listen for incoming
connections
        
 connections
        server.start();

 
        

 
        //
preventing application from exiting
        
 preventing application from exiting
        System.out.println("Press enter to exit");

        

        System.in.read();

        

        // stop the thread that listens for new
connections
        
 connections
        server.stop();

    }
 
    // this method is called for every new connection
    public void newFIXSession(FIXSession session) {
        try {
            

    }
 
    // this method is called for every new connection
    public void newFIXSession(FIXSession session) {
        try {
            activeSessions.add(session);

 
            

 
            // setting listener for incoming messages;

            

            // MyFIXSessionListener is is your class that
implements
            
 implements
            // the FIXSessionListener
interface
            
 interface
            session.setFIXSessionListener(new
 
 MyFIXSessionListener(session));

 
            

 
            // accept incoming
session
            
 session
            session.connect();

        catch (IOException e) {
        }
    }
 
    // listener for incoming messages and session state changes
    private class MyFIXSessionListener implements FIXSessionListener {
        private FIXSession session;
 
        public MyFIXSessionListener(FIXSession session) {
            this.session = session;
        }
 
        // this method will be called every time session state is changed
        public void onSessionStateChange(SessionState sessionState) {
            

        } catch (IOException e) {
        }
    }
 
    // listener for incoming messages and session state changes
    private class MyFIXSessionListener implements FIXSessionListener {
        private FIXSession session;
 
        public MyFIXSessionListener(FIXSession session) {
            this.session = session;
        }
 
        // this method will be called every time session state is changed
        public void onSessionStateChange(SessionState sessionState) {
            System.out.println("Session state: "
 
 + sessionState);

            

            // if disconnected, dispose it to let GC collect
it
            if (SessionState.DISCONNECTED == sessionState) {
                
 it
            if (SessionState.DISCONNECTED == sessionState) {
                session.dispose();

                

                System.out.println("Your session has been disconnected."

                        " Press ENTER to exit the programm.");
            }
        }
 
        public void onNewMessage(FIXFieldList message) {
            

                        + " Press ENTER to exit the programm.");
            }
        }
 
        public void onNewMessage(FIXFieldList message) {
            System.out.println("New message is accepted: "
 
 + message.toString());

        }
    }

        }
    }
}

5. Optional. Convert the dictionaries into FIXDIC format

...