public final class ReplicationManager extends Object implements org.apache.activemq.artemis.core.server.ActiveMQComponent, org.apache.activemq.artemis.spi.core.remoting.ReadyListener
Its equivalent in the backup server is ReplicationEndpoint.
ReplicationEndpoint| Modifier and Type | Class and Description |
|---|---|
static class |
ReplicationManager.ADD_OPERATION_TYPE |
| Constructor and Description |
|---|
ReplicationManager(org.apache.activemq.artemis.core.protocol.core.CoreRemotingConnection remotingConnection,
long timeout,
org.apache.activemq.artemis.utils.ExecutorFactory executorFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
appendAddRecordTransactional(byte journalID,
ReplicationManager.ADD_OPERATION_TYPE operation,
long txID,
long id,
byte recordType,
org.apache.activemq.artemis.core.journal.EncodingSupport record) |
void |
appendCommitRecord(byte journalID,
long txID,
boolean sync,
boolean lineUp) |
void |
appendDeleteRecord(byte journalID,
long id) |
void |
appendDeleteRecordTransactional(byte journalID,
long txID,
long id) |
void |
appendDeleteRecordTransactional(byte journalID,
long txID,
long id,
org.apache.activemq.artemis.core.journal.EncodingSupport record) |
void |
appendPrepareRecord(byte journalID,
long txID,
org.apache.activemq.artemis.core.journal.EncodingSupport transactionData) |
void |
appendRollbackRecord(byte journalID,
long txID) |
void |
appendUpdateRecord(byte journalID,
ReplicationManager.ADD_OPERATION_TYPE operation,
long id,
byte recordType,
org.apache.activemq.artemis.core.journal.EncodingSupport record) |
void |
clearReplicationTokens()
Completes any pending operations.
|
Set<OperationContext> |
getActiveTokens()
A list of tokens that are still waiting for replications to be completed
|
org.apache.activemq.artemis.core.protocol.core.CoreRemotingConnection |
getBackupTransportConnection()
Used while stopping the server to ensure that we freeze communications with the backup.
|
boolean |
isStarted() |
boolean |
isSynchronizing() |
void |
largeMessageBegin(long messageId) |
void |
largeMessageDelete(Long messageId) |
void |
largeMessageWrite(long messageId,
byte[] body) |
void |
pageClosed(org.apache.activemq.artemis.api.core.SimpleString storeName,
int pageNumber) |
void |
pageDeleted(org.apache.activemq.artemis.api.core.SimpleString storeName,
int pageNumber) |
void |
pageWrite(PagedMessage message,
int pageNumber) |
void |
readyForWriting() |
void |
sendLargeMessageIdListMessage(Map<Long,org.apache.activemq.artemis.api.core.Pair<String,Long>> largeMessages)
Reserves several LargeMessage IDs in the backup.
|
OperationContext |
sendLiveIsStopping(ReplicationLiveIsStoppingMessage.LiveStopping finalMessage)
Notifies the backup that the live server is stopping.
|
void |
sendStartSyncMessage(org.apache.activemq.artemis.core.journal.impl.JournalFile[] datafiles,
AbstractJournalStorageManager.JournalContent contentType,
String nodeID,
boolean allowsAutoFailBack)
Reserve the following fileIDs in the backup server.
|
void |
sendSynchronizationDone(String nodeID,
long initialReplicationSyncTimeout)
Informs backup that data synchronization is done.
|
void |
start() |
void |
stop() |
void |
syncJournalFile(org.apache.activemq.artemis.core.journal.impl.JournalFile jf,
AbstractJournalStorageManager.JournalContent content)
Sends the whole content of the file to be duplicated.
|
void |
syncLargeMessageFile(org.apache.activemq.artemis.core.io.SequentialFile file,
long size,
long id) |
void |
syncPages(org.apache.activemq.artemis.core.io.SequentialFile file,
long id,
org.apache.activemq.artemis.api.core.SimpleString queueName) |
public ReplicationManager(org.apache.activemq.artemis.core.protocol.core.CoreRemotingConnection remotingConnection,
long timeout,
org.apache.activemq.artemis.utils.ExecutorFactory executorFactory)
remotingConnection - public void appendUpdateRecord(byte journalID,
ReplicationManager.ADD_OPERATION_TYPE operation,
long id,
byte recordType,
org.apache.activemq.artemis.core.journal.EncodingSupport record)
throws Exception
Exceptionpublic void appendDeleteRecord(byte journalID,
long id)
throws Exception
Exceptionpublic void appendAddRecordTransactional(byte journalID,
ReplicationManager.ADD_OPERATION_TYPE operation,
long txID,
long id,
byte recordType,
org.apache.activemq.artemis.core.journal.EncodingSupport record)
throws Exception
Exceptionpublic void appendCommitRecord(byte journalID,
long txID,
boolean sync,
boolean lineUp)
throws Exception
Exceptionpublic void appendDeleteRecordTransactional(byte journalID,
long txID,
long id,
org.apache.activemq.artemis.core.journal.EncodingSupport record)
throws Exception
Exceptionpublic void appendDeleteRecordTransactional(byte journalID,
long txID,
long id)
throws Exception
Exceptionpublic void appendPrepareRecord(byte journalID,
long txID,
org.apache.activemq.artemis.core.journal.EncodingSupport transactionData)
throws Exception
Exceptionpublic void appendRollbackRecord(byte journalID,
long txID)
throws Exception
Exceptionpublic void pageClosed(org.apache.activemq.artemis.api.core.SimpleString storeName,
int pageNumber)
storeName - pageNumber - public void pageDeleted(org.apache.activemq.artemis.api.core.SimpleString storeName,
int pageNumber)
public void pageWrite(PagedMessage message, int pageNumber)
public void largeMessageBegin(long messageId)
public void largeMessageDelete(Long messageId)
public void largeMessageWrite(long messageId,
byte[] body)
public boolean isStarted()
isStarted in interface org.apache.activemq.artemis.core.server.ActiveMQComponentpublic void start()
throws org.apache.activemq.artemis.api.core.ActiveMQException
start in interface org.apache.activemq.artemis.core.server.ActiveMQComponentorg.apache.activemq.artemis.api.core.ActiveMQExceptionpublic void stop()
throws Exception
stop in interface org.apache.activemq.artemis.core.server.ActiveMQComponentExceptionpublic void clearReplicationTokens()
This can be necessary in case the live loses connection to the backup (network failure, or backup crashing).
public Set<OperationContext> getActiveTokens()
public void readyForWriting()
readyForWriting in interface org.apache.activemq.artemis.spi.core.remoting.ReadyListenerpublic void syncJournalFile(org.apache.activemq.artemis.core.journal.impl.JournalFile jf,
AbstractJournalStorageManager.JournalContent content)
throws Exception
org.apache.activemq.artemis.api.core.ActiveMQExceptionExceptionpublic void syncLargeMessageFile(org.apache.activemq.artemis.core.io.SequentialFile file,
long size,
long id)
throws Exception
Exceptionpublic void syncPages(org.apache.activemq.artemis.core.io.SequentialFile file,
long id,
org.apache.activemq.artemis.api.core.SimpleString queueName)
throws Exception
Exceptionpublic void sendStartSyncMessage(org.apache.activemq.artemis.core.journal.impl.JournalFile[] datafiles,
AbstractJournalStorageManager.JournalContent contentType,
String nodeID,
boolean allowsAutoFailBack)
throws org.apache.activemq.artemis.api.core.ActiveMQException
datafiles - contentType - org.apache.activemq.artemis.api.core.ActiveMQExceptionpublic void sendSynchronizationDone(String nodeID, long initialReplicationSyncTimeout)
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.
nodeID - public void sendLargeMessageIdListMessage(Map<Long,org.apache.activemq.artemis.api.core.Pair<String,Long>> largeMessages)
Doing this before hand removes the need of synchronizing large-message deletes with the largeMessageSyncList.
largeMessages - public OperationContext sendLiveIsStopping(ReplicationLiveIsStoppingMessage.LiveStopping finalMessage)
This notification allows the backup to skip quorum voting (or any other measure to avoid 'split-brain') and do a faster fail-over.
public org.apache.activemq.artemis.core.protocol.core.CoreRemotingConnection getBackupTransportConnection()
public boolean isSynchronizing()
Copyright © 2023 The Apache Software Foundation. All rights reserved.