Java Code Examples for org.apache.activemq.artemis.core.config.Configuration#setPersistenceEnabled()
The following examples show how to use
org.apache.activemq.artemis.core.config.Configuration#setPersistenceEnabled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActiveMqArtemisFacade.java From apm-agent-java with Apache License 2.0 | 6 votes |
@Override public void prepareResources() throws Exception { Configuration configuration = new ConfigurationImpl(); HashSet<TransportConfiguration> transports = new HashSet<>(); transports.add(new TransportConfiguration(InVMAcceptorFactory.class.getName())); configuration.setAcceptorConfigurations(transports); configuration.setSecurityEnabled(false); File targetDir = new File(System.getProperty("user.dir") + "/target"); configuration.setBrokerInstance(targetDir); configuration.setPersistenceEnabled(false); activeMQServer = new ActiveMQServerImpl(configuration); activeMQServer.start(); connectionFactory = new ActiveMQConnectionFactory("vm://0"); }
Example 2
Source File: EmbeddedBroker.java From cxf with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { Configuration config = new ConfigurationImpl(); Set<TransportConfiguration> transports = new HashSet<>(); transports.add(new TransportConfiguration(NettyAcceptorFactory.class.getName())); transports.add(new TransportConfiguration(InVMAcceptorFactory.class.getName())); config.setAcceptorConfigurations(transports); config.setBrokerInstance(new File("target/artemis")); config.setPersistenceEnabled(false); config.setSecurityEnabled(false); config.setJMXManagementEnabled(false); EmbeddedActiveMQ server = new EmbeddedActiveMQ(); server.setConfiguration(config); server.start(); try { System.out.println("JMS broker ready ..."); Thread.sleep(125 * 60 * 1000); } finally { System.out.println("JMS broker exiting"); server.stop(); } System.exit(0); }
Example 3
Source File: CriticalCrashTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
Configuration createConfig(String folder) throws Exception { Configuration configuration = createDefaultConfig(true); configuration.setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(100 * 1024).setJournalType(getDefaultJournalType()).setJournalDirectory(folder + "/journal").setBindingsDirectory(folder + "/bindings").setPagingDirectory(folder + "/paging"). setLargeMessagesDirectory(folder + "/largemessage").setJournalCompactMinFiles(0).setJournalCompactPercentage(0).setClusterPassword(CLUSTER_PASSWORD).setJournalDatasync(false); configuration.setSecurityEnabled(false); configuration.setPersistenceEnabled(true); return configuration; }
Example 4
Source File: ShutdownOnCriticalIOErrorMoveNextTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
Configuration createConfig(String folder) throws Exception { Configuration configuration = createDefaultConfig(true); configuration.setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(100 * 1024).setJournalType(getDefaultJournalType()).setJournalDirectory(folder + "/journal").setBindingsDirectory(folder + "/bindings").setPagingDirectory(folder + "/paging"). setLargeMessagesDirectory(folder + "/largemessage").setJournalCompactMinFiles(0).setJournalCompactPercentage(0).setClusterPassword(CLUSTER_PASSWORD).setJournalDatasync(false); configuration.setSecurityEnabled(false); configuration.setPersistenceEnabled(true); return configuration; }
Example 5
Source File: ActiveMQServers.java From activemq-artemis with Apache License 2.0 | 5 votes |
public static ActiveMQServer newActiveMQServer(final Configuration config, final MBeanServer mbeanServer, final ActiveMQSecurityManager securityManager, final boolean enablePersistence) { config.setPersistenceEnabled(enablePersistence); ActiveMQServer server = new ActiveMQServerImpl(config, mbeanServer, securityManager); return server; }
Example 6
Source File: ActiveMQTestBase.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected ActiveMQServer createInVMFailoverServer(final boolean realFiles, final Configuration configuration, final int pageSize, final int maxAddressSize, final Map<String, AddressSettings> settings, NodeManager nodeManager, final int id) { ActiveMQServer server; ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration()); configuration.setPersistenceEnabled(realFiles); server = addServer(new InVMNodeManagerServer(configuration, ManagementFactory.getPlatformMBeanServer(), securityManager, nodeManager)); try { server.setIdentity("Server " + id); for (Map.Entry<String, AddressSettings> setting : settings.entrySet()) { server.getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue()); } AddressSettings defaultSetting = new AddressSettings(); defaultSetting.setPageSizeBytes(pageSize); defaultSetting.setMaxSizeBytes(maxAddressSize); server.getAddressSettingsRepository().addMatch("#", defaultSetting); return server; } finally { addServer(server); } }
Example 7
Source File: ActiveMQTestBase.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected ActiveMQServer createColocatedInVMFailoverServer(final boolean realFiles, final Configuration configuration, final int pageSize, final int maxAddressSize, final Map<String, AddressSettings> settings, NodeManager liveNodeManager, NodeManager backupNodeManager, final int id) { ActiveMQServer server; ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration()); configuration.setPersistenceEnabled(realFiles); server = new ColocatedActiveMQServer(configuration, ManagementFactory.getPlatformMBeanServer(), securityManager, liveNodeManager, backupNodeManager); try { server.setIdentity("Server " + id); for (Map.Entry<String, AddressSettings> setting : settings.entrySet()) { server.getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue()); } AddressSettings defaultSetting = new AddressSettings(); defaultSetting.setPageSizeBytes(pageSize); defaultSetting.setMaxSizeBytes(maxAddressSize); server.getAddressSettingsRepository().addMatch("#", defaultSetting); return server; } finally { addServer(server); } }
Example 8
Source File: StompTestBase.java From activemq-artemis with Apache License 2.0 | 4 votes |
/** * @return * @throws Exception */ protected ActiveMQServer createServer() throws Exception { String stompAcceptorURI = "tcp://" + TransportConstants.DEFAULT_HOST + ":" + TransportConstants.DEFAULT_STOMP_PORT + "?" + TransportConstants.STOMP_CONSUMERS_CREDIT + "=-1"; if (isEnableStompMessageId()) { stompAcceptorURI += ";" + TransportConstants.STOMP_ENABLE_MESSAGE_ID + "=true"; } if (getStompMinLargeMessageSize() != null) { stompAcceptorURI += ";" + TransportConstants.STOMP_MIN_LARGE_MESSAGE_SIZE + "=2048"; } Configuration config = createBasicConfig().setSecurityEnabled(isSecurityEnabled()) .setPersistenceEnabled(isPersistenceEnabled()) .addAcceptorConfiguration("stomp", stompAcceptorURI) .addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())) .setConnectionTtlCheckInterval(500) .addQueueConfiguration(new QueueConfiguration(getQueueName()).setRoutingType(RoutingType.ANYCAST)) .addAddressConfiguration(new CoreAddressConfiguration().setName(getTopicName()).addRoutingType(RoutingType.MULTICAST)); if (getIncomingInterceptors() != null) { config.setIncomingInterceptorClassNames(getIncomingInterceptors()); } if (getOutgoingInterceptors() != null) { config.setOutgoingInterceptorClassNames(getOutgoingInterceptors()); } config.setPersistenceEnabled(true); ActiveMQServer activeMQServer = addServer(ActiveMQServers.newActiveMQServer(config, defUser, defPass)); if (isSecurityEnabled()) { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) activeMQServer.getSecurityManager(); final String role = "testRole"; securityManager.getConfiguration().addRole(defUser, role); config.getSecurityRoles().put("#", new HashSet<Role>() { { add(new Role(role, true, true, true, true, true, true, true, true, true, true)); } }); } return activeMQServer; }
Example 9
Source File: CriticalCrashTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
ActiveMQServer createServer(String folder) throws Exception { final AtomicBoolean blocked = new AtomicBoolean(false); Configuration conf = createConfig(folder); ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration()); conf.setPersistenceEnabled(true); ActiveMQServer server = new ActiveMQServerImpl(conf, securityManager) { @Override protected StorageManager createStorageManager() { JournalStorageManager storageManager = new JournalStorageManager(conf, getCriticalAnalyzer(), executorFactory, scheduledPool, ioExecutorFactory, shutdownOnCriticalIO) { @Override public void readLock() { super.readLock(); if (blocked.get()) { while (true) { try { Thread.sleep(1000); } catch (Throwable ignored) { } } } } @Override public void storeMessage(Message message) throws Exception { super.storeMessage(message); blocked.set(true); } }; this.getCriticalAnalyzer().add(storageManager); return storageManager; } }; return server; }
Example 10
Source File: ShutdownOnCriticalIOErrorMoveNextTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
ActiveMQServer createServer(String folder) throws Exception { final AtomicBoolean blocked = new AtomicBoolean(false); Configuration conf = createConfig(folder); ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration()); conf.setPersistenceEnabled(true); ActiveMQServer server = new ActiveMQServerImpl(conf, securityManager) { @Override protected StorageManager createStorageManager() { JournalStorageManager storageManager = new JournalStorageManager(conf, getCriticalAnalyzer(), executorFactory, scheduledPool, ioExecutorFactory, shutdownOnCriticalIO) { @Override protected Journal createMessageJournal(Configuration config, IOCriticalErrorListener criticalErrorListener, int fileSize) { return new JournalImpl(ioExecutorFactory, fileSize, config.getJournalMinFiles(), config.getJournalPoolFiles(), config.getJournalCompactMinFiles(), config.getJournalCompactPercentage(), config.getJournalFileOpenTimeout(), journalFF, "activemq-data", "amq", journalFF.getMaxIO(), 0, criticalErrorListener) { @Override protected void moveNextFile(boolean scheduleReclaim) throws Exception { super.moveNextFile(scheduleReclaim); if (blocked.get()) { throw new IllegalStateException("forcibly down"); } } }; } @Override public void storeMessage(Message message) throws Exception { super.storeMessage(message); blocked.set(true); } }; this.getCriticalAnalyzer().add(storageManager); return storageManager; } }; return server; }