use of org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupRegistrationMessage in project activemq-artemis by apache.
the class ServerPacketDecoder method slowPathDecode.
// separating for performance reasons
private Packet slowPathDecode(ActiveMQBuffer in, byte packetType, CoreRemotingConnection connection) {
Packet packet;
switch(packetType) {
case SESS_SEND_LARGE:
{
packet = new SessionSendLargeMessage(new CoreMessage());
break;
}
case REPLICATION_APPEND:
{
packet = new ReplicationAddMessage();
break;
}
case REPLICATION_APPEND_TX:
{
packet = new ReplicationAddTXMessage();
break;
}
case REPLICATION_DELETE:
{
packet = new ReplicationDeleteMessage();
break;
}
case REPLICATION_DELETE_TX:
{
packet = new ReplicationDeleteTXMessage();
break;
}
case REPLICATION_PREPARE:
{
packet = new ReplicationPrepareMessage();
break;
}
case REPLICATION_COMMIT_ROLLBACK:
{
packet = new ReplicationCommitMessage();
break;
}
case REPLICATION_RESPONSE:
{
packet = new ReplicationResponseMessage();
break;
}
case REPLICATION_RESPONSE_V2:
{
packet = new ReplicationResponseMessageV2();
break;
}
case REPLICATION_PAGE_WRITE:
{
packet = new ReplicationPageWriteMessage();
break;
}
case REPLICATION_PAGE_EVENT:
{
packet = new ReplicationPageEventMessage();
break;
}
case REPLICATION_LARGE_MESSAGE_BEGIN:
{
packet = new ReplicationLargeMessageBeginMessage();
break;
}
case REPLICATION_LARGE_MESSAGE_END:
{
packet = new ReplicationLargeMessageEndMessage();
break;
}
case REPLICATION_LARGE_MESSAGE_WRITE:
{
packet = new ReplicationLargeMessageWriteMessage();
break;
}
case PacketImpl.BACKUP_REGISTRATION:
{
packet = new BackupRegistrationMessage();
break;
}
case PacketImpl.BACKUP_REGISTRATION_FAILED:
{
packet = new BackupReplicationStartFailedMessage();
break;
}
case PacketImpl.REPLICATION_START_FINISH_SYNC:
{
packet = new ReplicationStartSyncMessage();
break;
}
case PacketImpl.REPLICATION_SYNC_FILE:
{
packet = new ReplicationSyncFileMessage();
break;
}
case PacketImpl.REPLICATION_SCHEDULED_FAILOVER:
{
packet = new ReplicationLiveIsStoppingMessage();
break;
}
case CLUSTER_CONNECT:
{
packet = new ClusterConnectMessage();
break;
}
case CLUSTER_CONNECT_REPLY:
{
packet = new ClusterConnectReplyMessage();
break;
}
case NODE_ANNOUNCE:
{
packet = new NodeAnnounceMessage();
break;
}
case BACKUP_REQUEST:
{
packet = new BackupRequestMessage();
break;
}
case BACKUP_REQUEST_RESPONSE:
{
packet = new BackupResponseMessage();
break;
}
case QUORUM_VOTE:
{
packet = new QuorumVoteMessage();
break;
}
case QUORUM_VOTE_REPLY:
{
packet = new QuorumVoteReplyMessage();
break;
}
case SCALEDOWN_ANNOUNCEMENT:
{
packet = new ScaleDownAnnounceMessage();
break;
}
default:
{
packet = super.decode(packetType, connection);
}
}
packet.decode(in);
return packet;
}
use of org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupRegistrationMessage in project activemq-artemis by apache.
the class ClusterControl method announceReplicatingBackupToLive.
/**
* XXX HORNETQ-720
*
* @param attemptingFailBack if {@code true} then this server wants to trigger a fail-back when
* up-to-date, that is it wants to take over the role of 'live' from the current 'live'
* server.
* @throws ActiveMQException
*/
public void announceReplicatingBackupToLive(final boolean attemptingFailBack, String replicationClusterName) throws ActiveMQException {
ClusterConnectionConfiguration config = ConfigurationUtils.getReplicationClusterConfiguration(server.getConfiguration(), replicationClusterName);
if (config == null) {
ActiveMQServerLogger.LOGGER.announceBackupNoClusterConnections();
throw new ActiveMQException("lacking cluster connection");
}
TransportConfiguration connector = server.getConfiguration().getConnectorConfigurations().get(config.getConnectorName());
if (connector == null) {
ActiveMQServerLogger.LOGGER.announceBackupNoConnector(config.getConnectorName());
throw new ActiveMQException("lacking cluster connection");
}
clusterChannel.send(new BackupRegistrationMessage(connector, clusterUser, clusterPassword, attemptingFailBack));
}
use of org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupRegistrationMessage in project activemq-artemis by apache.
the class SharedNothingLiveActivation method getActivationChannelHandler.
@Override
public ChannelHandler getActivationChannelHandler(final Channel channel, final Acceptor acceptorUsed) {
return new ChannelHandler() {
@Override
public void handlePacket(Packet packet) {
if (packet.getType() == PacketImpl.BACKUP_REGISTRATION) {
BackupRegistrationMessage msg = (BackupRegistrationMessage) packet;
ClusterConnection clusterConnection = acceptorUsed.getClusterConnection();
try {
startReplication(channel.getConnection(), clusterConnection, getPair(msg.getConnector(), true), msg.isFailBackRequest());
} catch (ActiveMQAlreadyReplicatingException are) {
channel.send(new BackupReplicationStartFailedMessage(BackupReplicationStartFailedMessage.BackupRegistrationProblem.ALREADY_REPLICATING));
} catch (ActiveMQException e) {
logger.debug("Failed to process backup registration packet", e);
channel.send(new BackupReplicationStartFailedMessage(BackupReplicationStartFailedMessage.BackupRegistrationProblem.EXCEPTION));
}
}
}
};
}
Aggregations