use of org.apache.activemq.artemis.core.protocol.core.impl.CoreProtocolManagerFactory in project activemq-artemis by apache.
the class ClusterTestBase method setupLiveServer.
protected void setupLiveServer(final int node, final boolean fileStorage, final boolean sharedStorage, final boolean netty, boolean liveOnly) throws Exception {
if (servers[node] != null) {
throw new IllegalArgumentException("Already a server at node " + node);
}
HAPolicyConfiguration haPolicyConfiguration = null;
if (liveOnly) {
haPolicyConfiguration = new LiveOnlyPolicyConfiguration();
} else {
if (sharedStorage)
haPolicyConfiguration = new SharedStoreMasterPolicyConfiguration();
else
haPolicyConfiguration = new ReplicatedPolicyConfiguration();
}
Configuration configuration = createBasicConfig(node).setJournalMaxIO_AIO(1000).setThreadPoolMaxSize(10).clearAcceptorConfigurations().addAcceptorConfiguration(createTransportConfiguration(netty, true, generateParams(node, netty))).setHAPolicyConfiguration(haPolicyConfiguration).setResolveProtocols(isResolveProtocols());
ActiveMQServer server;
if (fileStorage) {
if (sharedStorage) {
server = createInVMFailoverServer(true, configuration, nodeManagers[node], node);
} else {
server = createServer(configuration);
}
} else {
if (sharedStorage) {
server = createInVMFailoverServer(false, configuration, nodeManagers[node], node);
} else {
server = createServer(false, configuration);
}
}
server.addProtocolManagerFactory(new CoreProtocolManagerFactory());
server.setIdentity(this.getClass().getSimpleName() + "/Live(" + node + ")");
servers[node] = addServer(server);
}
use of org.apache.activemq.artemis.core.protocol.core.impl.CoreProtocolManagerFactory in project activemq-artemis by apache.
the class MessageJournalTest method testStoreCore.
@Test
public void testStoreCore() throws Throwable {
ActiveMQServer server = createServer(true);
server.start();
CoreMessage message = new CoreMessage().initBuffer(10 * 1024).setDurable(true);
message.setMessageID(333);
CoreProtocolManagerFactory factory = (CoreProtocolManagerFactory) server.getRemotingService().getProtocolFactoryMap().get("CORE");
Assert.assertNotNull(factory);
message.getBodyBuffer().writeByte((byte) 'Z');
server.getStorageManager().storeMessage(message);
server.getStorageManager().stop();
JournalStorageManager journalStorageManager = (JournalStorageManager) server.getStorageManager();
List<RecordInfo> committedRecords = new LinkedList<>();
List<PreparedTransactionInfo> preparedTransactions = new LinkedList<>();
TransactionFailureCallback transactionFailure = new TransactionFailureCallback() {
@Override
public void failedTransaction(long transactionID, List<RecordInfo> records, List<RecordInfo> recordsToDelete) {
}
};
try {
journalStorageManager.getMessageJournal().start();
journalStorageManager.getMessageJournal().load(committedRecords, preparedTransactions, transactionFailure);
Assert.assertEquals(1, committedRecords.size());
} finally {
journalStorageManager.getMessageJournal().stop();
}
}
Aggregations