Table of Contents |
---|
Overview
Cluster implementation is scalable, customizable, and provides several endpoints for integration.
...
Code Block | ||
---|---|---|
| ||
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); |
- REPLICATION_LEADER_PORT - a port that the leader is listening for a synchronization request from backups.
- REPLICATION_BROADCAST_PORT - a port that each backup node is listening for replication data from the leader.
Initialize replication backup
...
Upon adding the new item to internal storage, the leader sends a
QUEUE_ADD
orSEQUENCE_APPEND
message. New data and an internal ordered index are sent with this message.The backup receives this message and compares the expected index with the received one.
If the received index is different then expected, it starts a synchronization procedure (see Data synchronization procedure, n.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 | ||
---|---|---|
| ||
storageFactory=com.epam.fixengine.storage.persistence.PersistenceEnableFactory //(1) storage.persistenceFactoryBuilder=com.epam.fixengine.storage.persistence.ReplicatedPersistenceFactoryBuilder //(2) replicationTimeout=10 //(3) |
- Use
PersistenceEnableFactory
for thestorageFactory
property. This factory allows using the Persistence API for storing a FIX session's state.PersistenceEnableFactory
is based onFilesystemStorageFactory
and delegates all operation Persistence API objects. Working with this API requires the implementation ofPersistentFactoryBuilder
. The last one should construct an instance ofPersistenceFactory
. - Define
ReplicatedPersistenceFactoryBuilder
like a factory builder forPersistenceEnableFactory
.ReplicatedPersistenceFactoryBuilder
implementsPersistentFactoryBuilder
and builds a replicated instance of the factory. It usesreplicationTimeout
options from the FIX antenna configs Antenna config (or from the session’sConfiguration
instance) to configure synchronous or asynchronous replication for the FIX session. - Define replication timeout in milliseconds. A zero value for this option will enable asynchronous replication for a FIX session.