ARTEMIS-2888 ARTEMIS-2859 ARTEMIS-2768 - revert new page-store-name addressSetting, when the page store respects the target address and the size is tallied on the target address store, it is no longer neecessary
This commit is contained in:
parent
211c8d0b63
commit
583bd3602a
|
@ -109,7 +109,6 @@ public class QueueConfiguration implements Serializable {
|
||||||
private Boolean internal;
|
private Boolean internal;
|
||||||
private Boolean _transient;
|
private Boolean _transient;
|
||||||
private Boolean autoCreated;
|
private Boolean autoCreated;
|
||||||
private transient SimpleString pageStoreName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate this object and invoke {@link #setName(SimpleString)}
|
* Instantiate this object and invoke {@link #setName(SimpleString)}
|
||||||
|
@ -878,12 +877,4 @@ public class QueueConfiguration implements Serializable {
|
||||||
+ ", transient=" + _transient
|
+ ", transient=" + _transient
|
||||||
+ ", autoCreated=" + autoCreated + ']';
|
+ ", autoCreated=" + autoCreated + ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPageStoreName(SimpleString pageStoreName) {
|
|
||||||
this.pageStoreName = pageStoreName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SimpleString getPageStoreName() {
|
|
||||||
return pageStoreName != null ? pageStoreName : getAddress();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,7 +296,6 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
|
||||||
|
|
||||||
private static final String ENABLE_METRICS = "enable-metrics";
|
private static final String ENABLE_METRICS = "enable-metrics";
|
||||||
|
|
||||||
private static final String PAGE_STORE_NAME = "page-store-name";
|
|
||||||
|
|
||||||
// Attributes ----------------------------------------------------
|
// Attributes ----------------------------------------------------
|
||||||
|
|
||||||
|
@ -1267,8 +1266,6 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
|
||||||
addressSettings.setExpiryQueueSuffix(new SimpleString(getTrimmedTextContent(child)));
|
addressSettings.setExpiryQueueSuffix(new SimpleString(getTrimmedTextContent(child)));
|
||||||
} else if (ENABLE_METRICS.equalsIgnoreCase(name)) {
|
} else if (ENABLE_METRICS.equalsIgnoreCase(name)) {
|
||||||
addressSettings.setEnableMetrics(XMLUtil.parseBoolean(child));
|
addressSettings.setEnableMetrics(XMLUtil.parseBoolean(child));
|
||||||
} else if (PAGE_STORE_NAME.equalsIgnoreCase(name)) {
|
|
||||||
addressSettings.setPageStoreName(new SimpleString(getTrimmedTextContent(child)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return setting;
|
return setting;
|
||||||
|
|
|
@ -336,14 +336,6 @@ public final class PagingManagerImpl implements PagingManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deletePageStore(final SimpleString storeName) throws Exception {
|
public void deletePageStore(final SimpleString storeName) throws Exception {
|
||||||
final AddressSettings addressSettings = addressSettingsRepository.getMatch(storeName.toString());
|
|
||||||
if (addressSettings != null && addressSettings.getPageStoreName() != null) {
|
|
||||||
if (logger.isTraceEnabled()) {
|
|
||||||
logger.tracev("not deleting potentially shared pageAddress {} match for {}", addressSettings.getPageStoreName(), storeName);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
syncLock.readLock().lock();
|
syncLock.readLock().lock();
|
||||||
try {
|
try {
|
||||||
PagingStore store = stores.remove(storeName);
|
PagingStore store = stores.remove(storeName);
|
||||||
|
@ -360,16 +352,11 @@ public final class PagingManagerImpl implements PagingManager {
|
||||||
* This method creates a new store if not exist.
|
* This method creates a new store if not exist.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PagingStore getPageStore(SimpleString storeName) throws Exception {
|
public PagingStore getPageStore(final SimpleString storeName) throws Exception {
|
||||||
if (managementAddress != null && storeName.startsWith(managementAddress)) {
|
if (managementAddress != null && storeName.startsWith(managementAddress)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final AddressSettings addressSettings = addressSettingsRepository.getMatch(storeName.toString());
|
|
||||||
if (addressSettings != null && addressSettings.getPageStoreName() != null) {
|
|
||||||
storeName = addressSettings.getPageStoreName();
|
|
||||||
}
|
|
||||||
|
|
||||||
PagingStore store = stores.get(storeName);
|
PagingStore store = stores.get(storeName);
|
||||||
if (store != null) {
|
if (store != null) {
|
||||||
return store;
|
return store;
|
||||||
|
|
|
@ -49,11 +49,7 @@ public class AddressImpl implements Address {
|
||||||
this.address = address;
|
this.address = address;
|
||||||
this.wildcardConfiguration = wildcardConfiguration;
|
this.wildcardConfiguration = wildcardConfiguration;
|
||||||
addressParts = address.split(wildcardConfiguration.getDelimiter());
|
addressParts = address.split(wildcardConfiguration.getDelimiter());
|
||||||
containsWildCard = isContainsWildCard(address, wildcardConfiguration);
|
containsWildCard = address.contains(wildcardConfiguration.getSingleWord()) || address.contains(wildcardConfiguration.getAnyWords());
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isContainsWildCard(SimpleString address, WildcardConfiguration wildcardConfiguration) {
|
|
||||||
return address.contains(wildcardConfiguration.getSingleWord()) || address.contains(wildcardConfiguration.getAnyWords());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1706,9 +1706,6 @@ public interface ActiveMQServerLogger extends BasicLogger {
|
||||||
"**************************************************************************************************************************************************************************************************************************************************************", format = Message.Format.MESSAGE_FORMAT)
|
"**************************************************************************************************************************************************************************************************************************************************************", format = Message.Format.MESSAGE_FORMAT)
|
||||||
void possibleSplitBrain(String nodeID, String connectionPairInformation);
|
void possibleSplitBrain(String nodeID, String connectionPairInformation);
|
||||||
|
|
||||||
@LogMessage(level = Logger.Level.WARN)
|
|
||||||
@Message(id = 222295, value = "Subscription {0} uses wildcard address {1} but no matching address-setting has configured the shared page-store-name; counters may be inaccurate", format = Message.Format.MESSAGE_FORMAT)
|
|
||||||
void wildcardRoutingWithoutSharedPageStore(SimpleString queueName, SimpleString address);
|
|
||||||
|
|
||||||
@LogMessage(level = Logger.Level.WARN)
|
@LogMessage(level = Logger.Level.WARN)
|
||||||
@Message(id = 222296, value = "Unable to deploy Hawtio MBeam, console client side RBAC not available",
|
@Message(id = 222296, value = "Unable to deploy Hawtio MBeam, console client side RBAC not available",
|
||||||
|
|
|
@ -104,7 +104,6 @@ import org.apache.activemq.artemis.core.postoffice.Binding;
|
||||||
import org.apache.activemq.artemis.core.postoffice.BindingType;
|
import org.apache.activemq.artemis.core.postoffice.BindingType;
|
||||||
import org.apache.activemq.artemis.core.postoffice.PostOffice;
|
import org.apache.activemq.artemis.core.postoffice.PostOffice;
|
||||||
import org.apache.activemq.artemis.core.postoffice.QueueBinding;
|
import org.apache.activemq.artemis.core.postoffice.QueueBinding;
|
||||||
import org.apache.activemq.artemis.core.postoffice.impl.AddressImpl;
|
|
||||||
import org.apache.activemq.artemis.core.postoffice.impl.DivertBinding;
|
import org.apache.activemq.artemis.core.postoffice.impl.DivertBinding;
|
||||||
import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding;
|
import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding;
|
||||||
import org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl;
|
import org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl;
|
||||||
|
@ -3560,12 +3559,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final AddressSettings addressSettings = addressSettingsRepository.getMatch(getRuntimeTempQueueNamespace(queueConfiguration.isTemporary()) + queueConfiguration.getAddress().toString());
|
QueueConfigurationUtils.applyDynamicQueueDefaults(queueConfiguration, addressSettingsRepository.getMatch(getRuntimeTempQueueNamespace(queueConfiguration.isTemporary()) + queueConfiguration.getAddress().toString()));
|
||||||
QueueConfigurationUtils.applyDynamicQueueDefaults(queueConfiguration, addressSettings);
|
|
||||||
|
|
||||||
if (AddressImpl.isContainsWildCard(queueConfiguration.getAddress(), configuration.getWildcardConfiguration()) && addressSettings.getPageStoreName() == null) {
|
|
||||||
ActiveMQServerLogger.LOGGER.wildcardRoutingWithoutSharedPageStore(queueConfiguration.getName(), queueConfiguration.getAddress());
|
|
||||||
}
|
|
||||||
|
|
||||||
AddressInfo info = postOffice.getAddressInfo(queueConfiguration.getAddress());
|
AddressInfo info = postOffice.getAddressInfo(queueConfiguration.getAddress());
|
||||||
if (queueConfiguration.isAutoCreateAddress() || queueConfiguration.isTemporary()) {
|
if (queueConfiguration.isAutoCreateAddress() || queueConfiguration.isTemporary()) {
|
||||||
|
|
|
@ -46,6 +46,5 @@ public class QueueConfigurationUtils {
|
||||||
config.setAutoDeleteMessageCount(config.getAutoDeleteMessageCount() == null ? as.getAutoDeleteQueuesMessageCount() : config.getAutoDeleteMessageCount());
|
config.setAutoDeleteMessageCount(config.getAutoDeleteMessageCount() == null ? as.getAutoDeleteQueuesMessageCount() : config.getAutoDeleteMessageCount());
|
||||||
|
|
||||||
config.setEnabled(config.isEnabled() == null ? ActiveMQDefaultConfiguration.getDefaultEnabled() : config.isEnabled());
|
config.setEnabled(config.isEnabled() == null ? ActiveMQDefaultConfiguration.getDefaultEnabled() : config.isEnabled());
|
||||||
config.setPageStoreName(as.getPageStoreName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class QueueFactoryImpl implements QueueFactory {
|
||||||
PageSubscription pageSubscription;
|
PageSubscription pageSubscription;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PagingStore pageStore = pagingManager.getPageStore(queueConfiguration.getPageStoreName());
|
PagingStore pageStore = pagingManager.getPageStore(queueConfiguration.getAddress());
|
||||||
if (pageStore != null) {
|
if (pageStore != null) {
|
||||||
pageSubscription = pageStore.getCursorProvider().createSubscription(queueConfiguration.getId(), FilterImpl.createFilter(queueConfiguration.getFilterString()), queueConfiguration.isDurable());
|
pageSubscription = pageStore.getCursorProvider().createSubscription(queueConfiguration.getId(), FilterImpl.createFilter(queueConfiguration.getFilterString()), queueConfiguration.isDurable());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -253,8 +253,6 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
||||||
|
|
||||||
private Boolean enableMetrics = null;
|
private Boolean enableMetrics = null;
|
||||||
|
|
||||||
private SimpleString pageStoreName = null;
|
|
||||||
|
|
||||||
//from amq5
|
//from amq5
|
||||||
//make it transient
|
//make it transient
|
||||||
private transient Integer queuePrefetch = null;
|
private transient Integer queuePrefetch = null;
|
||||||
|
@ -320,7 +318,6 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
||||||
this.defaultGroupFirstKey = other.defaultGroupFirstKey;
|
this.defaultGroupFirstKey = other.defaultGroupFirstKey;
|
||||||
this.defaultRingSize = other.defaultRingSize;
|
this.defaultRingSize = other.defaultRingSize;
|
||||||
this.enableMetrics = other.enableMetrics;
|
this.enableMetrics = other.enableMetrics;
|
||||||
this.pageStoreName = other.pageStoreName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AddressSettings() {
|
public AddressSettings() {
|
||||||
|
@ -917,15 +914,6 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleString getPageStoreName() {
|
|
||||||
return pageStoreName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AddressSettings setPageStoreName(final SimpleString pageStoreName) {
|
|
||||||
this.pageStoreName = pageStoreName;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* merge 2 objects in to 1
|
* merge 2 objects in to 1
|
||||||
*
|
*
|
||||||
|
@ -1119,9 +1107,6 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
||||||
if (enableMetrics == null) {
|
if (enableMetrics == null) {
|
||||||
enableMetrics = merged.enableMetrics;
|
enableMetrics = merged.enableMetrics;
|
||||||
}
|
}
|
||||||
if (pageStoreName == null) {
|
|
||||||
pageStoreName = merged.pageStoreName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1335,10 +1320,6 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
||||||
defaultGroupRebalancePauseDispatch = BufferHelper.readNullableBoolean(buffer);
|
defaultGroupRebalancePauseDispatch = BufferHelper.readNullableBoolean(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer.readableBytes() > 0) {
|
|
||||||
pageStoreName = buffer.readNullableSimpleString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1402,8 +1383,7 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
||||||
SimpleString.sizeofNullableString(expiryQueuePrefix) +
|
SimpleString.sizeofNullableString(expiryQueuePrefix) +
|
||||||
SimpleString.sizeofNullableString(expiryQueueSuffix) +
|
SimpleString.sizeofNullableString(expiryQueueSuffix) +
|
||||||
BufferHelper.sizeOfNullableBoolean(enableMetrics) +
|
BufferHelper.sizeOfNullableBoolean(enableMetrics) +
|
||||||
BufferHelper.sizeOfNullableBoolean(defaultGroupRebalancePauseDispatch) +
|
BufferHelper.sizeOfNullableBoolean(defaultGroupRebalancePauseDispatch);
|
||||||
SimpleString.sizeofNullableString(pageStoreName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1530,7 +1510,6 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
||||||
|
|
||||||
BufferHelper.writeNullableBoolean(buffer, defaultGroupRebalancePauseDispatch);
|
BufferHelper.writeNullableBoolean(buffer, defaultGroupRebalancePauseDispatch);
|
||||||
|
|
||||||
buffer.writeNullableSimpleString(pageStoreName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -1602,7 +1581,6 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
||||||
result = prime * result + ((expiryQueuePrefix == null) ? 0 : expiryQueuePrefix.hashCode());
|
result = prime * result + ((expiryQueuePrefix == null) ? 0 : expiryQueuePrefix.hashCode());
|
||||||
result = prime * result + ((expiryQueueSuffix == null) ? 0 : expiryQueueSuffix.hashCode());
|
result = prime * result + ((expiryQueueSuffix == null) ? 0 : expiryQueueSuffix.hashCode());
|
||||||
result = prime * result + ((enableMetrics == null) ? 0 : enableMetrics.hashCode());
|
result = prime * result + ((enableMetrics == null) ? 0 : enableMetrics.hashCode());
|
||||||
result = prime * result + ((pageStoreName == null) ? 0 : pageStoreName.hashCode());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1950,12 +1928,6 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
||||||
} else if (!enableMetrics.equals(other.enableMetrics))
|
} else if (!enableMetrics.equals(other.enableMetrics))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (pageStoreName == null) {
|
|
||||||
if (other.pageStoreName != null)
|
|
||||||
return false;
|
|
||||||
} else if (!pageStoreName.equals(other.pageStoreName))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2085,7 +2057,6 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
||||||
expiryQueueSuffix +
|
expiryQueueSuffix +
|
||||||
", enableMetrics=" +
|
", enableMetrics=" +
|
||||||
enableMetrics +
|
enableMetrics +
|
||||||
", pageAddress=" + pageStoreName +
|
|
||||||
"]";
|
"]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3729,21 +3729,13 @@
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
<xsd:element name="page-store-name" type="xsd:string" maxOccurs="1" minOccurs="0">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
the name of the page store to use, to allow the page store to coalesce for address hierarchies when wildcard routing is in play
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
|
|
||||||
</xsd:all>
|
</xsd:all>
|
||||||
|
|
||||||
<xsd:attribute name="match" type="xsd:string" use="required">
|
<xsd:attribute name="match" type="xsd:string" use="required">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
pattern for matching settings against addresses; can use wildcards
|
pattern for matching settings against addresses; can use wildards
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
</xsd:attribute>
|
</xsd:attribute>
|
||||||
|
|
|
@ -378,8 +378,6 @@ public class FileConfigurationTest extends ConfigurationImplTest {
|
||||||
assertEquals(3, conf.getAddressesSettings().get("a1").getDefaultRingSize());
|
assertEquals(3, conf.getAddressesSettings().get("a1").getDefaultRingSize());
|
||||||
assertEquals(0, conf.getAddressesSettings().get("a1").getRetroactiveMessageCount());
|
assertEquals(0, conf.getAddressesSettings().get("a1").getRetroactiveMessageCount());
|
||||||
assertTrue(conf.getAddressesSettings().get("a1").isEnableMetrics());
|
assertTrue(conf.getAddressesSettings().get("a1").isEnableMetrics());
|
||||||
assertNull("none fonfigured", conf.getAddressesSettings().get("a1").getPageStoreName());
|
|
||||||
assertEquals(new SimpleString("a2.shared"), conf.getAddressesSettings().get("a2").getPageStoreName());
|
|
||||||
|
|
||||||
assertEquals("a2.1", conf.getAddressesSettings().get("a2").getDeadLetterAddress().toString());
|
assertEquals("a2.1", conf.getAddressesSettings().get("a2").getDeadLetterAddress().toString());
|
||||||
assertEquals(true, conf.getAddressesSettings().get("a2").isAutoCreateDeadLetterResources());
|
assertEquals(true, conf.getAddressesSettings().get("a2").isAutoCreateDeadLetterResources());
|
||||||
|
|
|
@ -481,7 +481,6 @@
|
||||||
<default-consumer-window-size>10000</default-consumer-window-size>
|
<default-consumer-window-size>10000</default-consumer-window-size>
|
||||||
<retroactive-message-count>10</retroactive-message-count>
|
<retroactive-message-count>10</retroactive-message-count>
|
||||||
<enable-metrics>false</enable-metrics>
|
<enable-metrics>false</enable-metrics>
|
||||||
<page-store-name>a2.shared</page-store-name>
|
|
||||||
</address-setting>
|
</address-setting>
|
||||||
</address-settings>
|
</address-settings>
|
||||||
<resource-limit-settings>
|
<resource-limit-settings>
|
||||||
|
|
|
@ -78,6 +78,5 @@
|
||||||
<default-consumer-window-size>10000</default-consumer-window-size>
|
<default-consumer-window-size>10000</default-consumer-window-size>
|
||||||
<retroactive-message-count>10</retroactive-message-count>
|
<retroactive-message-count>10</retroactive-message-count>
|
||||||
<enable-metrics>false</enable-metrics>
|
<enable-metrics>false</enable-metrics>
|
||||||
<page-store-name>a2.shared</page-store-name>
|
|
||||||
</address-setting>
|
</address-setting>
|
||||||
</address-settings>
|
</address-settings>
|
|
@ -781,38 +781,6 @@ the client-side. If the value is `BLOCK` then client message producers will
|
||||||
block when they try and send further messages. See the [Flow
|
block when they try and send further messages. See the [Flow
|
||||||
Control](flow-control.md) and [Paging](paging.md) chapters for more info.
|
Control](flow-control.md) and [Paging](paging.md) chapters for more info.
|
||||||
|
|
||||||
`page-store-name` defines the name of the shared page store for matching addresses.
|
|
||||||
It is typically unused because the page store name maps to an address name by default.
|
|
||||||
However when addresses are hierarchical and subscriptions use
|
|
||||||
[wildcards](wildcard-routing.md), this setting is **required** to support [paging](paging.md).
|
|
||||||
Subscriptions assume a single page store for cursor management and resource usage
|
|
||||||
calculations. Using an explicitly configured `page-store-name` that will match the
|
|
||||||
root address of the hierarchy, paging can coalesce to a single page store and
|
|
||||||
the required assumptions will hold.
|
|
||||||
|
|
||||||
For example, with a MULTICAST address hierarchy of:
|
|
||||||
- ticker.stock.us.apple
|
|
||||||
- ticker.stock.us.orange
|
|
||||||
- ticker.stock.eu.pear
|
|
||||||
|
|
||||||
and with wildcard subscriptions on:
|
|
||||||
- ticker.stock.#
|
|
||||||
- ticker.stock.eu.#
|
|
||||||
|
|
||||||
an address setting of:
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<address-settings>
|
|
||||||
<address-setting match="ticker.stock.#">
|
|
||||||
<page-store-name>ticker.stock.#</page-store-name>
|
|
||||||
...
|
|
||||||
```
|
|
||||||
will ensure that all paged messages coalesce into a single page store named `ticker.stock.#`.
|
|
||||||
The name does not need to be the same as the `match` attribute, it can be any string value.
|
|
||||||
What **is** important is that the `match` attribute captures the root of the hierarchy that will
|
|
||||||
support wildcards subscriptions.
|
|
||||||
|
|
||||||
|
|
||||||
`message-counter-history-day-limit` is the number of days to keep message
|
`message-counter-history-day-limit` is the number of days to keep message
|
||||||
counter history for this address assuming that `message-counter-enabled` is
|
counter history for this address assuming that `message-counter-enabled` is
|
||||||
`true`. Default is `0`.
|
`true`. Default is `0`.
|
||||||
|
|
|
@ -20,18 +20,5 @@ This functionality is enabled by default. To turn it off add the following to th
|
||||||
</wildcard-addresses>
|
</wildcard-addresses>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Paging with wild card addresses
|
|
||||||
Paging occurs at the address level and queue subscriptions access messages for an address through paging.
|
|
||||||
When wildcard routing is in play, it is normal for a queue to access multiple addresses and hence, potentially
|
|
||||||
multiple page stores.
|
|
||||||
To avoid the problems inherent in referencing multiple page stores, it is necessary to configure a wild card addresses
|
|
||||||
hierarchy with a single shared page store via an address setting called `page-store-name`.
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<address-setting match="news.#">
|
|
||||||
<page-store-name>news-wildcard</page-store-name>
|
|
||||||
</address-setting>
|
|
||||||
```
|
|
||||||
|
|
||||||
For more information on the wild card syntax and how to configure it, take a look at [wildcard syntax](wildcard-syntax.md) chapter,
|
For more information on the wild card syntax and how to configure it, take a look at [wildcard syntax](wildcard-syntax.md) chapter,
|
||||||
also see the topic hierarchy example in the [examples](examples.md).
|
also see the topic hierarchy example in the [examples](examples.md).
|
||||||
|
|
|
@ -56,7 +56,10 @@ under the License.
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<ignore>${noServer}</ignore>
|
<ignore>${noServer}</ignore>
|
||||||
<configuration>${basedir}/target/classes/activemq/server0</configuration>
|
<args>
|
||||||
|
<arg>--addresses</arg>
|
||||||
|
<arg>news,news.usa,news.usa.wrestling,news.europe,news.europe.sport,news.europe.entertainment</arg>
|
||||||
|
</args>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
|
|
|
@ -8,14 +8,4 @@ ActiveMQ Artemis wild-cards can use the character `#` which means "match any num
|
||||||
|
|
||||||
For example if I subscribe using the wild-card `news.europe.#`, then that would match messages sent to the addresses `news.europe`, `news.europe.sport` and `news.europe.entertainment`, but it does not match messages sent to the address `news.usa.wrestling`.
|
For example if I subscribe using the wild-card `news.europe.#`, then that would match messages sent to the addresses `news.europe`, `news.europe.sport` and `news.europe.entertainment`, but it does not match messages sent to the address `news.usa.wrestling`.
|
||||||
|
|
||||||
Note that wildcard subscribers need some explicit configuration with respect to paging. The entire hierarchy needs to page to a single address such that subscribers don't race to store and account for individual messages.
|
|
||||||
|
|
||||||
Notice the address setting in broker.xml that configures matching address (the root of the hierarchy) to use the shared "news-wildcard" page store.
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<address-setting match="news.#">
|
|
||||||
<page-store-name>news-wildcard</page-store-name>
|
|
||||||
</address-setting>
|
|
||||||
```
|
|
||||||
|
|
||||||
For more information on the wild-card syntax please consult the user manual.
|
For more information on the wild-card syntax please consult the user manual.
|
|
@ -1,68 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!--
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
or more contributor license agreements. See the NOTICE file
|
|
||||||
distributed with this work for additional information
|
|
||||||
regarding copyright ownership. The ASF licenses this file
|
|
||||||
to you under the Apache License, Version 2.0 (the
|
|
||||||
"License"); you may not use this file except in compliance
|
|
||||||
with the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
|
||||||
software distributed under the License is distributed on an
|
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
KIND, either express or implied. See the License for the
|
|
||||||
specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
-->
|
|
||||||
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
|
|
||||||
<core xmlns="urn:activemq:core">
|
|
||||||
|
|
||||||
<bindings-directory>./data/bindings</bindings-directory>
|
|
||||||
|
|
||||||
<journal-directory>./data/journal</journal-directory>
|
|
||||||
|
|
||||||
<large-messages-directory>./data/largemessages</large-messages-directory>
|
|
||||||
|
|
||||||
<paging-directory>./data/paging</paging-directory>
|
|
||||||
|
|
||||||
<!-- Acceptors -->
|
|
||||||
<acceptors>
|
|
||||||
<acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
|
|
||||||
</acceptors>
|
|
||||||
|
|
||||||
<!-- Other config -->
|
|
||||||
|
|
||||||
<security-settings>
|
|
||||||
<!--security for example queue-->
|
|
||||||
<security-setting match="#">
|
|
||||||
<permission roles="guest" type="createDurableQueue"/>
|
|
||||||
<permission roles="guest" type="deleteDurableQueue"/>
|
|
||||||
<permission roles="guest" type="createNonDurableQueue"/>
|
|
||||||
<permission roles="guest" type="deleteNonDurableQueue"/>
|
|
||||||
<permission roles="guest" type="createAddress"/>
|
|
||||||
<permission roles="guest" type="deleteAddress"/>
|
|
||||||
<permission roles="guest" type="consume"/>
|
|
||||||
<permission roles="guest" type="send"/>
|
|
||||||
</security-setting>
|
|
||||||
</security-settings>
|
|
||||||
|
|
||||||
<address-settings>
|
|
||||||
<!-- ensure that all addresses in the topic hierarchy reference a single shared page store -->
|
|
||||||
<address-setting match="news.#">
|
|
||||||
<page-store-name>news-wildcard</page-store-name>
|
|
||||||
</address-setting>
|
|
||||||
</address-settings>
|
|
||||||
|
|
||||||
<addresses>
|
|
||||||
<address name="news"/>
|
|
||||||
<address name="news.usa"/>
|
|
||||||
<address name="news.usa.wrestling"/>
|
|
||||||
<address name="news.europe"/>
|
|
||||||
<address name="news.europe.sport"/>
|
|
||||||
<address name="news.europe.entertainment"/>
|
|
||||||
</addresses>
|
|
||||||
</core>
|
|
||||||
</configuration>
|
|
|
@ -16,9 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.artemis.tests.integration.jms.client;
|
package org.apache.activemq.artemis.tests.integration.jms.client;
|
||||||
|
|
||||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
|
||||||
import org.apache.activemq.artemis.core.config.Configuration;
|
import org.apache.activemq.artemis.core.config.Configuration;
|
||||||
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
|
|
||||||
import org.apache.activemq.artemis.tests.util.JMSTestBase;
|
import org.apache.activemq.artemis.tests.util.JMSTestBase;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -55,7 +53,6 @@ public class WildcardTest extends JMSTestBase {
|
||||||
@Override
|
@Override
|
||||||
protected Configuration createDefaultConfig(boolean netty) throws Exception {
|
protected Configuration createDefaultConfig(boolean netty) throws Exception {
|
||||||
Configuration configuration = super.createDefaultConfig(netty).setJMXManagementEnabled(true);
|
Configuration configuration = super.createDefaultConfig(netty).setJMXManagementEnabled(true);
|
||||||
configuration.getAddressesSettings().put("test.#", new AddressSettings().setPageStoreName(new SimpleString("test-topic-hierarchy-root")));
|
|
||||||
return configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,6 @@ public class MqttWildCardSubAutoCreateTest extends MQTTTestSupport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ActiveMQServer createServer(final boolean realFiles, final Configuration configuration) {
|
protected ActiveMQServer createServer(final boolean realFiles, final Configuration configuration) {
|
||||||
configuration.getAddressesSettings().put("A.#", new AddressSettings().setPageSizeBytes(5).setMaxSizeBytes(10).setPageStoreName(new SimpleString("a-bag")));
|
|
||||||
configuration.getAddressesSettings().put("news.#", new AddressSettings().setPageSizeBytes(5).setMaxSizeBytes(10).setPageStoreName(new SimpleString("news-bag")));
|
|
||||||
configuration.setGlobalMaxSize(15);
|
configuration.setGlobalMaxSize(15);
|
||||||
return createServer(realFiles, configuration, AddressSettings.DEFAULT_PAGE_SIZE, 10);
|
return createServer(realFiles, configuration, AddressSettings.DEFAULT_PAGE_SIZE, 10);
|
||||||
}
|
}
|
||||||
|
@ -227,7 +225,7 @@ public class MqttWildCardSubAutoCreateTest extends MQTTTestSupport {
|
||||||
messageConsumerAllNews.close();
|
messageConsumerAllNews.close();
|
||||||
|
|
||||||
int countOfPageStores = server.getPagingManager().getStoreNames().length;
|
int countOfPageStores = server.getPagingManager().getStoreNames().length;
|
||||||
assertEquals("there should only be one", 1, countOfPageStores);
|
assertEquals("there should be 5", 5, countOfPageStores);
|
||||||
|
|
||||||
connection.close();
|
connection.close();
|
||||||
|
|
||||||
|
@ -240,26 +238,4 @@ public class MqttWildCardSubAutoCreateTest extends MQTTTestSupport {
|
||||||
private void addSizeProp(TextMessage messageWrestlingNews) throws JMSException {
|
private void addSizeProp(TextMessage messageWrestlingNews) throws JMSException {
|
||||||
messageWrestlingNews.setStringProperty("stuff", new String(new byte[1024]));
|
messageWrestlingNews.setStringProperty("stuff", new String(new byte[1024]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testWarnOnWildcardWithNoMatchingPageStoreName() throws Exception {
|
|
||||||
|
|
||||||
try {
|
|
||||||
AssertionLoggerHandler.startCapture();
|
|
||||||
|
|
||||||
ConnectionFactory cf = new ActiveMQConnectionFactory();
|
|
||||||
Connection connection = cf.createConnection();
|
|
||||||
connection.setClientID("some-sensible-identity");
|
|
||||||
connection.start();
|
|
||||||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
|
||||||
MessageConsumer messageConsumer = session.createDurableConsumer(session.createTopic("b.c.#"), "w-a-warn");
|
|
||||||
messageConsumer.close();
|
|
||||||
|
|
||||||
connection.close();
|
|
||||||
Assert.assertTrue(AssertionLoggerHandler.findText("222295"));
|
|
||||||
} finally {
|
|
||||||
AssertionLoggerHandler.stopCapture();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -29,7 +29,6 @@ import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
|
||||||
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
|
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
|
||||||
import org.apache.activemq.artemis.core.config.Configuration;
|
import org.apache.activemq.artemis.core.config.Configuration;
|
||||||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
||||||
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
|
|
||||||
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
|
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
|
||||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -40,7 +39,6 @@ public class PagingSizeWildcardTest extends ActiveMQTestBase {
|
||||||
public void testWildcardPageSize() throws Exception {
|
public void testWildcardPageSize() throws Exception {
|
||||||
|
|
||||||
Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false);
|
Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false);
|
||||||
config.getAddressesSettings().put("A.#", new AddressSettings().setPageStoreName(new SimpleString("shared-page-store-for-a#")));
|
|
||||||
|
|
||||||
ActiveMQServer server = createServer(true, config, 200, 400);
|
ActiveMQServer server = createServer(true, config, 200, 400);
|
||||||
server.start();
|
server.start();
|
||||||
|
|
|
@ -6591,92 +6591,6 @@ public class PagingTest extends ActiveMQTestBase {
|
||||||
server.stop();
|
server.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testHierarchicalPagingStoreNotDestroyed() throws Exception {
|
|
||||||
clearDataRecreateServerDirs();
|
|
||||||
|
|
||||||
final SimpleString pageAddress = new SimpleString("A.#");
|
|
||||||
Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false);
|
|
||||||
config.getAddressesSettings().put("A.#", new AddressSettings().setPageStoreName(pageAddress));
|
|
||||||
|
|
||||||
server = createServer(true, config, 100, 500);
|
|
||||||
|
|
||||||
server.start();
|
|
||||||
|
|
||||||
final int numberOfMessages = 10;
|
|
||||||
final int messageSize = 100;
|
|
||||||
|
|
||||||
locator = createInVMNonHALocator().setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setBlockOnAcknowledge(true);
|
|
||||||
|
|
||||||
sf = createSessionFactory(locator);
|
|
||||||
|
|
||||||
ClientSession session = sf.createSession(false, false, false);
|
|
||||||
|
|
||||||
final SimpleString addressA = new SimpleString("A.a.#");
|
|
||||||
session.createQueue(new QueueConfiguration(addressA));
|
|
||||||
|
|
||||||
final SimpleString addressB = new SimpleString("A.b.#");
|
|
||||||
session.createQueue(new QueueConfiguration(addressB));
|
|
||||||
|
|
||||||
final SimpleString produceAddressA = new SimpleString("A.a.a");
|
|
||||||
ClientProducer producerA = session.createProducer(produceAddressA);
|
|
||||||
|
|
||||||
final SimpleString produceAddressB = new SimpleString("A.b.a");
|
|
||||||
ClientProducer producerB = session.createProducer(produceAddressB);
|
|
||||||
|
|
||||||
ClientMessage message = null;
|
|
||||||
|
|
||||||
byte[] body = new byte[messageSize];
|
|
||||||
|
|
||||||
ByteBuffer bb = ByteBuffer.wrap(body);
|
|
||||||
|
|
||||||
for (int j = 1; j <= messageSize; j++) {
|
|
||||||
bb.put(getSamplebyte(j));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < numberOfMessages; i++) {
|
|
||||||
message = session.createMessage(true);
|
|
||||||
|
|
||||||
ActiveMQBuffer bodyLocal = message.getBodyBuffer();
|
|
||||||
|
|
||||||
bodyLocal.writeBytes(body);
|
|
||||||
|
|
||||||
producerA.send(message);
|
|
||||||
producerB.send(message);
|
|
||||||
session.commit();
|
|
||||||
}
|
|
||||||
session.commit();
|
|
||||||
producerA.close();
|
|
||||||
producerB.close();
|
|
||||||
|
|
||||||
assertTrue(Arrays.asList(server.getPagingManager().getStoreNames()).contains(pageAddress));
|
|
||||||
assertTrue(server.getPagingManager().getPageStore(pageAddress).isPaging());
|
|
||||||
|
|
||||||
session.deleteQueue(addressA);
|
|
||||||
session.deleteQueue(addressB);
|
|
||||||
|
|
||||||
session.close();
|
|
||||||
|
|
||||||
System.err.println("storeNames: " + Arrays.asList(server.getPagingManager().getStoreNames()));
|
|
||||||
|
|
||||||
server.getPagingManager().deletePageStore(produceAddressA);
|
|
||||||
server.getPagingManager().deletePageStore(produceAddressB);
|
|
||||||
|
|
||||||
sf.close();
|
|
||||||
locator.close();
|
|
||||||
locator = null;
|
|
||||||
sf = null;
|
|
||||||
assertTrue(Arrays.asList(server.getPagingManager().getStoreNames()).contains(pageAddress));
|
|
||||||
// Ensure wildcard store is still there
|
|
||||||
server.getPagingManager().reloadStores();
|
|
||||||
assertTrue(Arrays.asList(server.getPagingManager().getStoreNames()).contains(pageAddress));
|
|
||||||
server.stop();
|
|
||||||
|
|
||||||
server.start();
|
|
||||||
assertTrue(Arrays.asList(server.getPagingManager().getStoreNames()).contains(pageAddress));
|
|
||||||
server.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStopPagingWithoutConsumersIfTwoPages() throws Exception {
|
public void testStopPagingWithoutConsumersIfTwoPages() throws Exception {
|
||||||
testStopPagingWithoutConsumersOnOneQueue(true);
|
testStopPagingWithoutConsumersOnOneQueue(true);
|
||||||
|
|
Loading…
Reference in New Issue