Versions Compared

Key

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

Table of Contents

Overview

Cluster implementation is scalable, customizable, and provides several endpoints for integration.

...

Code Block
languagejava
HazelcastCluster clusterManager = new HazelcastClusterManager();

// create controller for enable/disable leader replication role
ReplicationLeader replicationLeaderService = new ReplicationLeader(aeronTransport,correlationIdHolder,
        REPLICATION_LEADER_PORT,    										//(1)
        REPLICATION_BROADCAST_PORT, 										//(2)
        "./logs/" + name);

// register listener for enabling/disabling replication functionality for leader
LocalNodeLeaderListener leaderListener = new ReplicationLeaderListener(replicationLeaderService);
        clusterManager.addLocalNodeLeaderListener(leaderListener);
  1. REPLICATION_LEADER_PORT - a port that the leader is listening for a synchronization request from backups.
  2. REPLICATION_BROADCAST_PORT - a port that each backup node is listening for replication data from the leader.

Initialize replication backup

...

  1. Upon adding the new item to internal storage, the leader sends a QUEUE_ADD or SEQUENCE_APPEND message. New data and an internal ordered index are sent with this message.

  2. The backup receives this message and compares the expected index with the received one.

  3. If the received index is different then expected, it starts a synchronization procedure (see Data synchronization procedure, n.4)

  4. If the leader indicates that this is synchronous storage and expects acknowledgment, the backup sends back an ACK message.

...

To enable replicated storage for a FIX session, it needs to setup a replication leader and a backup (Initialize replication leader, Initialize replication backup), and use the following configuration options for FIX antenna (in fixengine.properties) :

Code Block
languagejava
storageFactory=com.epam.fixengine.storage.persistence.PersistenceEnableFactory                                   //(1)
storage.persistenceFactoryBuilder=com.epam.fixengine.storage.persistence.ReplicatedPersistenceFactoryBuilder     //(2)
replicationTimeout=10                                                                                            //(3)
  1. Use PersistenceEnableFactory for the storageFactory property. This factory allows using the Persistence API for storing a FIX session's state. PersistenceEnableFactory is based on FilesystemStorageFactory and delegates all operation Persistence API objects. Working with this API requires the implementation of PersistentFactoryBuilder. The last one should construct an instance of PersistenceFactory.
  2. Define ReplicatedPersistenceFactoryBuilder like a factory builder for PersistenceEnableFactory. ReplicatedPersistenceFactoryBuilder implements PersistentFactoryBuilder and builds a replicated instance of the factory. It uses replicationTimeout options from the FIX antenna configs Antenna config (or from the session’s Configuration instance) to configure synchronous or asynchronous replication for the FIX session.
  3. Define replication timeout in milliseconds. A zero value for this option will enable asynchronous replication for a FIX session.