Class ReplicationManager
java.lang.Object
org.apache.activemq.artemis.core.replication.ReplicationManager
- All Implemented Interfaces:
ActiveMQComponent
Manages replication tasks on the primary server (i.e. the active server side of a "remote backup" use case).
Its equivalent in the backup server is ReplicationEndpoint.
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionReplicationManager(ActiveMQServer server, CoreRemotingConnection remotingConnection, long timeout, long initialReplicationSyncTimeout, ExecutorFactory ioExecutorFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidappendAddRecordTransactional(byte journalID, ReplicationManager.ADD_OPERATION_TYPE operation, long txID, long id, byte recordType, Persister persister, Object record) voidappendCommitRecord(byte journalID, long txID, boolean sync, boolean lineUp) voidappendDeleteRecord(byte journalID, long id) voidappendDeleteRecordTransactional(byte journalID, long txID, long id) voidappendDeleteRecordTransactional(byte journalID, long txID, long id, EncodingSupport record) voidappendPrepareRecord(byte journalID, long txID, EncodingSupport transactionData) voidappendRollbackRecord(byte journalID, long txID) voidappendUpdateRecord(byte journalID, ReplicationManager.ADD_OPERATION_TYPE operation, long id, byte recordType, Persister persister, Object record) voidCompletes any pending operations.A list of tokens that are still waiting for replications to be completedUsed while stopping the server to ensure that we freeze communications with the backup.booleanbooleanvoidlargeMessageBegin(long messageId) voidlargeMessageClosed(Long messageId, JournalStorageManager storageManager) voidlargeMessageDelete(Long messageId, JournalStorageManager storageManager) voidlargeMessageWrite(long messageId, byte[] body) voidpageClosed(SimpleString storeName, long pageNumber) voidpageDeleted(SimpleString storeName, long pageNumber) voidpageWrite(SimpleString address, PagedMessage message, long pageNumber, boolean lineup) voidReserves several LargeMessage IDs in the backup.Notifies the backup that the primary server is stopping.voidsendStartSyncMessage(JournalFile[] datafiles, AbstractJournalStorageManager.JournalContent contentType, String nodeID, boolean allowsAutoFailBack) Reserve the following fileIDs in the backup server.voidsendSynchronizationDone(String nodeID, long initialReplicationSyncTimeout, IOCriticalErrorListener criticalErrorListener) Informs backup that data synchronization is done.voidstart()voidstop()voidstop(boolean clearTokens) voidSends the whole content of the file to be duplicated.voidsyncLargeMessageFile(SequentialFile file, long size, long id) voidsyncPages(SequentialFile file, long id, SimpleString queueName) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop
-
Constructor Details
-
ReplicationManager
public ReplicationManager(ActiveMQServer server, CoreRemotingConnection remotingConnection, long timeout, long initialReplicationSyncTimeout, ExecutorFactory ioExecutorFactory)
-
-
Method Details
-
appendUpdateRecord
public void appendUpdateRecord(byte journalID, ReplicationManager.ADD_OPERATION_TYPE operation, long id, byte recordType, Persister persister, Object record) throws Exception - Throws:
Exception
-
appendDeleteRecord
- Throws:
Exception
-
appendAddRecordTransactional
public void appendAddRecordTransactional(byte journalID, ReplicationManager.ADD_OPERATION_TYPE operation, long txID, long id, byte recordType, Persister persister, Object record) throws Exception - Throws:
Exception
-
appendCommitRecord
public void appendCommitRecord(byte journalID, long txID, boolean sync, boolean lineUp) throws Exception - Throws:
Exception
-
appendDeleteRecordTransactional
public void appendDeleteRecordTransactional(byte journalID, long txID, long id, EncodingSupport record) throws Exception - Throws:
Exception
-
appendDeleteRecordTransactional
- Throws:
Exception
-
appendPrepareRecord
public void appendPrepareRecord(byte journalID, long txID, EncodingSupport transactionData) throws Exception - Throws:
Exception
-
appendRollbackRecord
- Throws:
Exception
-
pageClosed
-
pageDeleted
-
pageWrite
-
largeMessageBegin
public void largeMessageBegin(long messageId) -
largeMessageDelete
-
largeMessageClosed
-
largeMessageWrite
public void largeMessageWrite(long messageId, byte[] body) -
isStarted
public boolean isStarted()- Specified by:
isStartedin interfaceActiveMQComponent
-
start
- Specified by:
startin interfaceActiveMQComponent- Throws:
ActiveMQException
-
stop
- Specified by:
stopin interfaceActiveMQComponent- Throws:
Exception
-
stop
- Throws:
Exception
-
clearReplicationTokens
public void clearReplicationTokens()Completes any pending operations.This can be necessary in case the primary loses the connection to the backup (network failure, or backup crashing).
-
getActiveTokens
A list of tokens that are still waiting for replications to be completed -
syncJournalFile
public void syncJournalFile(JournalFile jf, AbstractJournalStorageManager.JournalContent content) throws Exception Sends the whole content of the file to be duplicated.- Throws:
Exception
-
syncLargeMessageFile
- Throws:
Exception
-
syncPages
- Throws:
Exception
-
sendStartSyncMessage
public void sendStartSyncMessage(JournalFile[] datafiles, AbstractJournalStorageManager.JournalContent contentType, String nodeID, boolean allowsAutoFailBack) throws ActiveMQException Reserve the following fileIDs in the backup server.- Throws:
ActiveMQException
-
sendSynchronizationDone
public void sendSynchronizationDone(String nodeID, long initialReplicationSyncTimeout, IOCriticalErrorListener criticalErrorListener) throws ActiveMQReplicationTimeooutException Informs backup that data synchronization is done.So if 'live' fails, the (up-to-date) backup now may take over its duties. To do so, it must know which is the live's
nodeID. -
sendLargeMessageIdListMessage
Reserves several LargeMessage IDs in the backup.Doing this before hand removes the need of synchronizing large-message deletes with the largeMessageSyncList.
-
sendPrimaryIsStopping
public OperationContext sendPrimaryIsStopping(ReplicationPrimaryIsStoppingMessage.PrimaryStopping finalMessage) Notifies the backup that the primary server is stopping.This notification allows the backup to skip quorum voting (or any other measure to avoid 'split-brain') and do a faster fail-over.
-
getBackupTransportConnection
Used while stopping the server to ensure that we freeze communications with the backup.- Returns:
- remoting connection with the backup
-
isSynchronizing
public boolean isSynchronizing()
-