Java Code Examples for org.apache.activemq.artemis.core.settings.impl.AddressSettings#setPageSizeBytes()
The following examples show how to use
org.apache.activemq.artemis.core.settings.impl.AddressSettings#setPageSizeBytes() .
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: AddressControlTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test public void testGetNumberOfBytesPerPage() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); session.createQueue(new QueueConfiguration(address)); AddressControl addressControl = createManagementControl(address); Assert.assertEquals(AddressSettings.DEFAULT_PAGE_SIZE, addressControl.getNumberOfBytesPerPage()); session.close(); server.stop(); AddressSettings addressSettings = new AddressSettings(); addressSettings.setPageSizeBytes(1024); server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings); server.start(); ServerLocator locator2 = createInVMNonHALocator(); ClientSessionFactory sf2 = createSessionFactory(locator2); session = sf2.createSession(false, true, false); session.createQueue(new QueueConfiguration(address)); Assert.assertEquals(1024, addressControl.getNumberOfBytesPerPage()); }
Example 2
Source File: ArtemisBrokerBase.java From activemq-artemis with Apache License 2.0 | 6 votes |
protected final ActiveMQServer createServer(final boolean realFiles, final Configuration configuration, final int pageSize, final int maxAddressSize, final AddressFullMessagePolicy fullPolicy, final Map<String, AddressSettings> settings) { ActiveMQServer server = ActiveMQServers.newActiveMQServer(configuration, realFiles); if (settings != null) { 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); defaultSetting.setAddressFullMessagePolicy(fullPolicy); server.getAddressSettingsRepository().addMatch("#", defaultSetting); return server; }
Example 3
Source File: SlowConsumerTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Before @Override public void setUp() throws Exception { super.setUp(); server = createServer(true, isNetty); AddressSettings addressSettings = new AddressSettings(); addressSettings.setSlowConsumerCheckPeriod(checkPeriod); addressSettings.setSlowConsumerThreshold(threshold); addressSettings.setSlowConsumerPolicy(SlowConsumerPolicy.KILL); if (isPaging) { addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addressSettings.setMaxSizeBytes(10 * 1024); addressSettings.setPageSizeBytes(1024); } else { addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK); addressSettings.setMaxSizeBytes(-1); addressSettings.setPageSizeBytes(1024); } server.start(); server.getAddressSettingsRepository().addMatch(QUEUE.toString(), addressSettings); server.createQueue(new QueueConfiguration(QUEUE).setRoutingType(RoutingType.ANYCAST)).getPageSubscription().getPagingStore().startPaging(); locator = createFactory(isNetty); }
Example 4
Source File: ClusteredMessageCounterTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected ConfigurationImpl createBasicConfig(final int serverID) { ConfigurationImpl config = super.createBasicConfig(serverID); Map<String, AddressSettings> addrSettingsMap = config.getAddressesSettings(); AddressSettings addrSettings = new AddressSettings(); addrSettings.setMaxSizeBytes(10 * 1024); addrSettings.setPageSizeBytes(5 * 1024); addrSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addrSettingsMap.put("queues", addrSettings); if (serverID == 1) { config.setMessageCounterEnabled(true); } return config; }
Example 5
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 6
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 7
Source File: AddressSettingsTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test public void testSingleMerge() { AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettingsToMerge = new AddressSettings(); SimpleString DLQ = new SimpleString("testDLQ"); SimpleString exp = new SimpleString("testExpiryQueue"); addressSettingsToMerge.setDeadLetterAddress(DLQ); addressSettingsToMerge.setExpiryAddress(exp); addressSettingsToMerge.setMaxDeliveryAttempts(1000); addressSettingsToMerge.setAddressFullMessagePolicy(AddressFullMessagePolicy.DROP); addressSettingsToMerge.setMaxSizeBytes(1001); addressSettingsToMerge.setMessageCounterHistoryDayLimit(1002); addressSettingsToMerge.setRedeliveryDelay(1003); addressSettingsToMerge.setPageSizeBytes(1004); addressSettingsToMerge.setMaxSizeBytesRejectThreshold(10 * 1024); addressSettings.merge(addressSettingsToMerge); Assert.assertEquals(addressSettings.getDeadLetterAddress(), DLQ); Assert.assertEquals(addressSettings.getExpiryAddress(), exp); Assert.assertEquals(addressSettings.getMaxDeliveryAttempts(), 1000); Assert.assertEquals(addressSettings.getMaxSizeBytes(), 1001); Assert.assertEquals(addressSettings.getMessageCounterHistoryDayLimit(), 1002); Assert.assertEquals(addressSettings.getRedeliveryDelay(), 1003); Assert.assertEquals(addressSettings.getPageSizeBytes(), 1004); Assert.assertEquals(AddressFullMessagePolicy.DROP, addressSettings.getAddressFullMessagePolicy()); Assert.assertEquals(addressSettings.getMaxSizeBytesRejectThreshold(), 10 * 1024); }
Example 8
Source File: Async.java From javalite with Apache License 2.0 | 5 votes |
private void configurePaging() { AddressSettings addressSettings = new AddressSettings(); addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addressSettings.setMaxSizeBytes(30 * 1024 * 1024L); addressSettings.setPageSizeBytes(10 * 1024 * 1024); addressSettings.setPageCacheMaxSize(20); config.getAddressesSettings().put("jms.queue.*", addressSettings); }