This closes #3063
This commit is contained in:
commit
42f75537e4
|
@ -41,6 +41,7 @@ import java.util.TreeSet;
|
|||
import io.airlift.airline.Command;
|
||||
import io.airlift.airline.Option;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
|
@ -415,7 +416,7 @@ public final class XmlDataImporter extends ActionAbstract {
|
|||
ClientSession.QueueQuery queueQuery = session.queueQuery(new SimpleString(queueName));
|
||||
|
||||
if (!queueQuery.isExists()) {
|
||||
session.createQueue(address, routingType, queueName, filter, true);
|
||||
session.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(routingType).setFilterString(filter));
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Binding queue(name=" + queueName + ", address=" + address + ", filter=" + filter + ")");
|
||||
}
|
||||
|
@ -457,7 +458,7 @@ public final class XmlDataImporter extends ActionAbstract {
|
|||
ClientSession.QueueQuery queueQuery = session.queueQuery(new SimpleString(queueName));
|
||||
|
||||
if (!queueQuery.isExists()) {
|
||||
session.createQueue(address, RoutingType.valueOf(routingType), queueName, filter, true);
|
||||
session.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(RoutingType.valueOf(routingType)).setFilterString(filter));
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Binding queue(name=" + queueName + ", address=" + address + ", filter=" + filter + ")");
|
||||
}
|
||||
|
|
|
@ -76,6 +76,10 @@
|
|||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-json_1.0_spec</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
|
|
@ -43,23 +43,39 @@ public class ParameterisedAddress {
|
|||
}
|
||||
|
||||
private final SimpleString address;
|
||||
private final QueueAttributes queueAttributes;
|
||||
private final QueueConfiguration queueConfiguration;
|
||||
|
||||
public SimpleString getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public QueueAttributes getQueueAttributes() {
|
||||
return queueAttributes;
|
||||
return QueueAttributes.fromQueueConfiguration(queueConfiguration);
|
||||
}
|
||||
|
||||
public QueueConfiguration getQueueConfiguration() {
|
||||
return queueConfiguration;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ParameterisedAddress(SimpleString address, QueueAttributes queueAttributes) {
|
||||
this.address = address;
|
||||
this.queueAttributes = queueAttributes;
|
||||
this.queueConfiguration = queueAttributes.toQueueConfiguration();
|
||||
}
|
||||
|
||||
public ParameterisedAddress(SimpleString address, QueueConfiguration queueConfiguration) {
|
||||
this.address = address;
|
||||
this.queueConfiguration = queueConfiguration;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ParameterisedAddress(String address, QueueAttributes queueAttributes) {
|
||||
this(SimpleString.toSimpleString(address), queueAttributes);
|
||||
this(SimpleString.toSimpleString(address), queueAttributes.toQueueConfiguration());
|
||||
}
|
||||
|
||||
public ParameterisedAddress(String address, QueueConfiguration queueConfiguration) {
|
||||
this(SimpleString.toSimpleString(address), queueConfiguration);
|
||||
}
|
||||
|
||||
public ParameterisedAddress(SimpleString address) {
|
||||
|
@ -70,21 +86,21 @@ public class ParameterisedAddress {
|
|||
int index = address.indexOf('?');
|
||||
if (index == -1) {
|
||||
this.address = SimpleString.toSimpleString(address);
|
||||
this.queueAttributes = null;
|
||||
this.queueConfiguration = null;
|
||||
} else {
|
||||
this.address = SimpleString.toSimpleString(address.substring(0, index));
|
||||
QueueAttributes queueAttributes = new QueueAttributes();
|
||||
QueueConfiguration queueConfiguration = new QueueConfiguration(address);
|
||||
try {
|
||||
parseQuery(address).forEach(queueAttributes::set);
|
||||
parseQuery(address).forEach(queueConfiguration::set);
|
||||
} catch (URISyntaxException use) {
|
||||
throw new IllegalArgumentException("Malformed parameters in address " + address);
|
||||
}
|
||||
this.queueAttributes = queueAttributes;
|
||||
this.queueConfiguration = queueConfiguration;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isParameterised() {
|
||||
return this.queueAttributes != null;
|
||||
return this.queueConfiguration != null;
|
||||
}
|
||||
|
||||
public static boolean isParameterised(String address) {
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.activemq.artemis.api.core;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Deprecated
|
||||
public class QueueAttributes implements Serializable {
|
||||
|
||||
public static final String ROUTING_TYPE = "routing-type";
|
||||
|
@ -106,6 +107,56 @@ public class QueueAttributes implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
public QueueConfiguration toQueueConfiguration() {
|
||||
return new QueueConfiguration("")
|
||||
.setDurable(this.getDurable())
|
||||
.setRoutingType(this.getRoutingType())
|
||||
.setExclusive(this.getExclusive())
|
||||
.setRingSize(this.getRingSize())
|
||||
.setGroupRebalance(this.getGroupRebalance())
|
||||
.setNonDestructive(this.getNonDestructive())
|
||||
.setLastValue(this.getLastValue())
|
||||
.setFilterString(this.getFilterString())
|
||||
.setMaxConsumers(this.getMaxConsumers())
|
||||
.setPurgeOnNoConsumers(this.getPurgeOnNoConsumers())
|
||||
.setConsumersBeforeDispatch(this.getConsumersBeforeDispatch())
|
||||
.setDelayBeforeDispatch(this.getDelayBeforeDispatch())
|
||||
.setGroupBuckets(this.getGroupBuckets())
|
||||
.setGroupFirstKey(this.getGroupFirstKey())
|
||||
.setLastValueKey(this.getLastValueKey())
|
||||
.setConsumerPriority(this.getConsumerPriority())
|
||||
.setAutoDelete(this.getAutoDelete())
|
||||
.setAutoDeleteMessageCount(this.getAutoDeleteMessageCount())
|
||||
.setAutoDeleteDelay(this.getAutoDeleteDelay());
|
||||
}
|
||||
|
||||
public static QueueAttributes fromQueueConfiguration(QueueConfiguration queueConfiguration) {
|
||||
if (queueConfiguration == null) {
|
||||
return null;
|
||||
} else {
|
||||
return new QueueAttributes()
|
||||
.setDurable(queueConfiguration.isDurable())
|
||||
.setRoutingType(queueConfiguration.getRoutingType())
|
||||
.setExclusive(queueConfiguration.isExclusive())
|
||||
.setRingSize(queueConfiguration.getRingSize())
|
||||
.setGroupRebalance(queueConfiguration.isGroupRebalance())
|
||||
.setNonDestructive(queueConfiguration.isNonDestructive())
|
||||
.setLastValue(queueConfiguration.isLastValue())
|
||||
.setFilterString(queueConfiguration.getFilterString())
|
||||
.setMaxConsumers(queueConfiguration.getMaxConsumers())
|
||||
.setPurgeOnNoConsumers(queueConfiguration.isPurgeOnNoConsumers())
|
||||
.setConsumersBeforeDispatch(queueConfiguration.getConsumersBeforeDispatch())
|
||||
.setDelayBeforeDispatch(queueConfiguration.getDelayBeforeDispatch())
|
||||
.setGroupBuckets(queueConfiguration.getGroupBuckets())
|
||||
.setGroupFirstKey(queueConfiguration.getGroupFirstKey())
|
||||
.setLastValueKey(queueConfiguration.getLastValueKey())
|
||||
.setConsumerPriority(queueConfiguration.getConsumerPriority())
|
||||
.setAutoDelete(queueConfiguration.isAutoDelete())
|
||||
.setAutoDeleteDelay(queueConfiguration.getAutoDeleteDelay())
|
||||
.setAutoDeleteMessageCount(queueConfiguration.getAutoDeleteMessageCount());
|
||||
}
|
||||
}
|
||||
|
||||
public RoutingType getRoutingType() {
|
||||
return routingType;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,841 @@
|
|||
/**
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apache.activemq.artemis.api.core;
|
||||
|
||||
import javax.json.JsonObject;
|
||||
import javax.json.JsonObjectBuilder;
|
||||
import javax.json.JsonString;
|
||||
import javax.json.JsonValue;
|
||||
import java.io.Serializable;
|
||||
import java.io.StringReader;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.activemq.artemis.utils.CompositeAddress;
|
||||
import org.apache.activemq.artemis.utils.JsonLoader;
|
||||
|
||||
/**
|
||||
* This class holds all the properties required to configure a queue. The only strictly required property is
|
||||
* {@code name}. Some defaults will be enforced for properties which are not explicitly set:
|
||||
* <p><ul>
|
||||
* <li>{@code address} : the value set for {@code name}
|
||||
* <li>{@code transient} : {@code false}
|
||||
* <li>{@code temporary} : {@code false}
|
||||
* <li>{@code durable} : {@code true}
|
||||
* <li>{@code autoCreated} : {@code false}
|
||||
* <li>{@code internal} : {@code false}
|
||||
* <li>{@code configurationManaged} : {@code false}
|
||||
* </ul><p>
|
||||
*/
|
||||
public class QueueConfiguration implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2601016432150225938L;
|
||||
|
||||
public static final String ID = "id";
|
||||
public static final String NAME = "name";
|
||||
public static final String ADDRESS = "address";
|
||||
public static final String ROUTING_TYPE = "routing-type";
|
||||
public static final String FILTER_STRING = "filter-string";
|
||||
public static final String DURABLE = "durable";
|
||||
public static final String USER = "user";
|
||||
public static final String MAX_CONSUMERS = "max-consumers";
|
||||
public static final String EXCLUSIVE = "exclusive";
|
||||
public static final String GROUP_REBALANCE = "group-rebalance";
|
||||
public static final String GROUP_BUCKETS = "group-buckets";
|
||||
public static final String GROUP_FIRST_KEY = "group-first-key";
|
||||
public static final String LAST_VALUE = "last-value";
|
||||
public static final String LAST_VALUE_KEY = "last-value-key";
|
||||
public static final String NON_DESTRUCTIVE = "non-destructive";
|
||||
public static final String PURGE_ON_NO_CONSUMERS = "purge-on-no-consumers";
|
||||
public static final String CONSUMERS_BEFORE_DISPATCH = "consumers-before-dispatch";
|
||||
public static final String DELAY_BEFORE_DISPATCH = "delay-before-dispatch";
|
||||
public static final String CONSUMER_PRIORITY = "consumer-priority";
|
||||
public static final String AUTO_DELETE = "auto-delete";
|
||||
public static final String AUTO_DELETE_DELAY = "auto-delete-delay";
|
||||
public static final String AUTO_DELETE_MESSAGE_COUNT = "auto-delete-message-count";
|
||||
public static final String RING_SIZE = "ring-size";
|
||||
public static final String CONFIGURATION_MANAGED = "configuration-managed";
|
||||
public static final String TEMPORARY = "temporary";
|
||||
public static final String AUTO_CREATE_ADDRESS = "auto-create-address";
|
||||
public static final String INTERNAL = "internal";
|
||||
public static final String TRANSIENT = "transient";
|
||||
public static final String AUTO_CREATED = "auto-created";
|
||||
|
||||
private Long id; // internal use
|
||||
private SimpleString name;
|
||||
private SimpleString address;
|
||||
private RoutingType routingType;
|
||||
private SimpleString filterString;
|
||||
private Boolean durable;
|
||||
private SimpleString user;
|
||||
private Integer maxConsumers;
|
||||
private Boolean exclusive;
|
||||
private Boolean groupRebalance;
|
||||
private Integer groupBuckets;
|
||||
private SimpleString groupFirstKey;
|
||||
private Boolean lastValue;
|
||||
private SimpleString lastValueKey;
|
||||
private Boolean nonDestructive;
|
||||
private Boolean purgeOnNoConsumers;
|
||||
private Integer consumersBeforeDispatch;
|
||||
private Long delayBeforeDispatch;
|
||||
private Integer consumerPriority;
|
||||
private Boolean autoDelete;
|
||||
private Long autoDeleteDelay;
|
||||
private Long autoDeleteMessageCount;
|
||||
private Long ringSize;
|
||||
private Boolean configurationManaged;
|
||||
private Boolean temporary;
|
||||
private Boolean autoCreateAddress;
|
||||
private Boolean internal;
|
||||
private Boolean _transient;
|
||||
private Boolean autoCreated;
|
||||
|
||||
/**
|
||||
* Instantiate this object and invoke {@link #setName(SimpleString)}
|
||||
*
|
||||
* @see #setName(SimpleString)
|
||||
*
|
||||
* @param name the name to use for the queue
|
||||
*/
|
||||
public QueueConfiguration(SimpleString name) {
|
||||
setName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate this object and invoke {@link #setName(SimpleString)}
|
||||
*
|
||||
* @see #setName(SimpleString)
|
||||
*
|
||||
* @param name the name to use for the queue
|
||||
*/
|
||||
public QueueConfiguration(String name) {
|
||||
this(SimpleString.toSimpleString(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of a parameter based on its "key" {@code String}. Valid key names and corresponding {@code static}
|
||||
* {@code final} are:
|
||||
* <p><ul>
|
||||
* <li>id: {@link #ID}
|
||||
* <li>name: {@link #NAME}
|
||||
* <li>address: {@link #ADDRESS}
|
||||
* <li>routing-type: {@link #ROUTING_TYPE}
|
||||
* <li>filter-string: {@link #FILTER_STRING}
|
||||
* <li>durable: {@link #DURABLE}
|
||||
* <li>user: {@link #USER}
|
||||
* <li>max-consumers: {@link #MAX_CONSUMERS}
|
||||
* <li>exclusive: {@link #EXCLUSIVE}
|
||||
* <li>group-rebalance: {@link #GROUP_BUCKETS}
|
||||
* <li>group-buckets: {@link #GROUP_BUCKETS}
|
||||
* <li>group-first-key: {@link #GROUP_FIRST_KEY}
|
||||
* <li>last-value: {@link #LAST_VALUE}
|
||||
* <li>last-value-key: {@link #LAST_VALUE_KEY}
|
||||
* <li>non-destructive: {@link #NON_DESTRUCTIVE}
|
||||
* <li>purge-on-no-consumers: {@link #PURGE_ON_NO_CONSUMERS}
|
||||
* <li>consumers-before-dispatch: {@link #CONSUMERS_BEFORE_DISPATCH}
|
||||
* <li>delay-before-dispatch: {@link #DELAY_BEFORE_DISPATCH}
|
||||
* <li>consumer-priority: {@link #CONSUMER_PRIORITY}
|
||||
* <li>auto-delete: {@link #AUTO_DELETE}
|
||||
* <li>auto-delete-delay: {@link #AUTO_DELETE_DELAY}
|
||||
* <li>auto-delete-message-count: {@link #AUTO_DELETE_MESSAGE_COUNT}
|
||||
* <li>ring-size: {@link #RING_SIZE}
|
||||
* <li>configuration-managed: {@link #ID}
|
||||
* <li>temporary: {@link #TEMPORARY}
|
||||
* <li>auto-create-address: {@link #AUTO_CREATE_ADDRESS}
|
||||
* <li>internal: {@link #INTERNAL}
|
||||
* <li>transient: {@link #TRANSIENT}
|
||||
* <li>auto-created: {@link #AUTO_CREATED}
|
||||
* </ul><p>
|
||||
* The {@code String}-based values will be converted to the proper value types based on the underlying property. For
|
||||
* example, if you pass the value "TRUE" for the key "auto-created" the {@code String} "TRUE" will be converted to
|
||||
* the {@code Boolean} {@code true}.
|
||||
*
|
||||
* @param key the key to set to the value
|
||||
* @param value the value to set for the key
|
||||
* @return this {@code QueueConfiguration}
|
||||
*/
|
||||
public QueueConfiguration set(String key, String value) {
|
||||
if (key != null && value != null) {
|
||||
if (key.equals(NAME)) {
|
||||
setName(value);
|
||||
} else if (key.equals(ADDRESS)) {
|
||||
setAddress(value);
|
||||
} else if (key.equals(ROUTING_TYPE)) {
|
||||
setRoutingType(RoutingType.valueOf(value));
|
||||
} else if (key.equals(FILTER_STRING)) {
|
||||
setFilterString(value);
|
||||
} else if (key.equals(DURABLE)) {
|
||||
setDurable(Boolean.valueOf(value));
|
||||
} else if (key.equals(USER)) {
|
||||
setUser(SimpleString.toSimpleString(value));
|
||||
} else if (key.equals(MAX_CONSUMERS)) {
|
||||
setMaxConsumers(Integer.valueOf(value));
|
||||
} else if (key.equals(EXCLUSIVE)) {
|
||||
setExclusive(Boolean.valueOf(value));
|
||||
} else if (key.equals(GROUP_REBALANCE)) {
|
||||
setGroupRebalance(Boolean.valueOf(value));
|
||||
} else if (key.equals(GROUP_BUCKETS)) {
|
||||
setGroupBuckets(Integer.valueOf(value));
|
||||
} else if (key.equals(GROUP_FIRST_KEY)) {
|
||||
setGroupFirstKey(value);
|
||||
} else if (key.equals(LAST_VALUE)) {
|
||||
setLastValue(Boolean.valueOf(value));
|
||||
} else if (key.equals(LAST_VALUE_KEY)) {
|
||||
setLastValueKey(value);
|
||||
} else if (key.equals(NON_DESTRUCTIVE)) {
|
||||
setNonDestructive(Boolean.valueOf(value));
|
||||
} else if (key.equals(PURGE_ON_NO_CONSUMERS)) {
|
||||
setPurgeOnNoConsumers(Boolean.valueOf(value));
|
||||
} else if (key.equals(CONSUMERS_BEFORE_DISPATCH)) {
|
||||
setConsumersBeforeDispatch(Integer.valueOf(value));
|
||||
} else if (key.equals(DELAY_BEFORE_DISPATCH)) {
|
||||
setDelayBeforeDispatch(Long.valueOf(value));
|
||||
} else if (key.equals(CONSUMER_PRIORITY)) {
|
||||
setConsumerPriority(Integer.valueOf(value));
|
||||
} else if (key.equals(AUTO_DELETE)) {
|
||||
setAutoDelete(Boolean.valueOf(value));
|
||||
} else if (key.equals(AUTO_DELETE_DELAY)) {
|
||||
setAutoDeleteDelay(Long.valueOf(value));
|
||||
} else if (key.equals(AUTO_DELETE_MESSAGE_COUNT)) {
|
||||
setAutoDeleteMessageCount(Long.valueOf(value));
|
||||
} else if (key.equals(RING_SIZE)) {
|
||||
setRingSize(Long.valueOf(value));
|
||||
} else if (key.equals(CONFIGURATION_MANAGED)) {
|
||||
setConfigurationManaged(Boolean.valueOf(value));
|
||||
} else if (key.equals(TEMPORARY)) {
|
||||
setTemporary(Boolean.valueOf(value));
|
||||
} else if (key.equals(AUTO_CREATE_ADDRESS)) {
|
||||
setAutoCreateAddress(Boolean.valueOf(value));
|
||||
} else if (key.equals(INTERNAL)) {
|
||||
setInternal(Boolean.valueOf(value));
|
||||
} else if (key.equals(TRANSIENT)) {
|
||||
setTransient(Boolean.valueOf(value));
|
||||
} else if (key.equals(AUTO_CREATED)) {
|
||||
setAutoCreated(Boolean.valueOf(value));
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public QueueConfiguration setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of the address; if the address is {@code null} then return the value of {@link #getName()}.
|
||||
*/
|
||||
public SimpleString getAddress() {
|
||||
return address == null ? getName() : address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name. If the fully-qualified queue name is used then it will be parsed and the corresponding values for
|
||||
* {@code address} and {@code name} will be set automatically. For example if "myAddress::myQueue" is passed then the
|
||||
* resulting value for {@code address} will be "myAddress" and the value for {@code name} will be "myQueue".
|
||||
*
|
||||
* @param address the address to use
|
||||
* @return this {@code QueueConfiguration}
|
||||
*/
|
||||
public QueueConfiguration setAddress(SimpleString address) {
|
||||
if (CompositeAddress.isFullyQualified(address)) {
|
||||
this.name = CompositeAddress.extractQueueName(address);
|
||||
this.address = CompositeAddress.extractAddressName(address);
|
||||
} else {
|
||||
this.address = address;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueueConfiguration#setAddress(SimpleString)
|
||||
*/
|
||||
public QueueConfiguration setAddress(String address) {
|
||||
return setAddress(SimpleString.toSimpleString(address));
|
||||
}
|
||||
|
||||
public SimpleString getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name. If the fully-qualified queue name is used then it will be parsed and the corresponding values for
|
||||
* {@code address} and {@code name} will be set automatically. For example if "myAddress::myQueue" is passed then the
|
||||
* resulting value for {@code address} will be "myAddress" and the value for {@code name} will be "myQueue".
|
||||
*
|
||||
* @param name the name to use
|
||||
* @return this {@code QueueConfiguration}
|
||||
*/
|
||||
public QueueConfiguration setName(SimpleString name) {
|
||||
if (CompositeAddress.isFullyQualified(name)) {
|
||||
this.name = CompositeAddress.extractQueueName(name);
|
||||
this.address = CompositeAddress.extractAddressName(name);
|
||||
} else {
|
||||
this.name = name;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueueConfiguration#setName(SimpleString)
|
||||
*/
|
||||
public QueueConfiguration setName(String name) {
|
||||
return setName(SimpleString.toSimpleString(name));
|
||||
}
|
||||
|
||||
public RoutingType getRoutingType() {
|
||||
return routingType;
|
||||
}
|
||||
|
||||
public QueueConfiguration setRoutingType(RoutingType routingType) {
|
||||
this.routingType = routingType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SimpleString getFilterString() {
|
||||
return filterString;
|
||||
}
|
||||
|
||||
public QueueConfiguration setFilterString(SimpleString filterString) {
|
||||
this.filterString = filterString;
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueueConfiguration setFilterString(String filterString) {
|
||||
return setFilterString(filterString == null ? null : SimpleString.toSimpleString(filterString));
|
||||
}
|
||||
|
||||
/**
|
||||
* defaults to {@code true}
|
||||
* @return
|
||||
*/
|
||||
public Boolean isDurable() {
|
||||
return durable == null ? true : durable;
|
||||
}
|
||||
|
||||
public QueueConfiguration setDurable(Boolean durable) {
|
||||
this.durable = durable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SimpleString getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public QueueConfiguration setUser(SimpleString user) {
|
||||
this.user = user;
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueueConfiguration setUser(String user) {
|
||||
return setUser(SimpleString.toSimpleString(user));
|
||||
}
|
||||
|
||||
public Integer getMaxConsumers() {
|
||||
return maxConsumers;
|
||||
}
|
||||
|
||||
public QueueConfiguration setMaxConsumers(Integer maxConsumers) {
|
||||
this.maxConsumers = maxConsumers;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean isExclusive() {
|
||||
return exclusive;
|
||||
}
|
||||
|
||||
public QueueConfiguration setExclusive(Boolean exclusive) {
|
||||
this.exclusive = exclusive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean isLastValue() {
|
||||
return lastValue;
|
||||
}
|
||||
|
||||
public QueueConfiguration setLastValue(Boolean lastValue) {
|
||||
this.lastValue = lastValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SimpleString getLastValueKey() {
|
||||
return lastValueKey;
|
||||
}
|
||||
|
||||
public QueueConfiguration setLastValueKey(SimpleString lastValueKey) {
|
||||
this.lastValueKey = lastValueKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueueConfiguration setLastValueKey(String lastValueKey) {
|
||||
return setLastValueKey(SimpleString.toSimpleString(lastValueKey));
|
||||
}
|
||||
|
||||
public Boolean isNonDestructive() {
|
||||
return nonDestructive;
|
||||
}
|
||||
|
||||
public QueueConfiguration setNonDestructive(Boolean nonDestructive) {
|
||||
this.nonDestructive = nonDestructive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean isPurgeOnNoConsumers() {
|
||||
return purgeOnNoConsumers;
|
||||
}
|
||||
|
||||
public QueueConfiguration setPurgeOnNoConsumers(Boolean purgeOnNoConsumers) {
|
||||
this.purgeOnNoConsumers = purgeOnNoConsumers;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getConsumersBeforeDispatch() {
|
||||
return consumersBeforeDispatch;
|
||||
}
|
||||
|
||||
public QueueConfiguration setConsumersBeforeDispatch(Integer consumersBeforeDispatch) {
|
||||
this.consumersBeforeDispatch = consumersBeforeDispatch;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getDelayBeforeDispatch() {
|
||||
return delayBeforeDispatch;
|
||||
}
|
||||
|
||||
public QueueConfiguration setDelayBeforeDispatch(Long delayBeforeDispatch) {
|
||||
this.delayBeforeDispatch = delayBeforeDispatch;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getConsumerPriority() {
|
||||
return consumerPriority;
|
||||
}
|
||||
|
||||
public QueueConfiguration setConsumerPriority(Integer consumerPriority) {
|
||||
this.consumerPriority = consumerPriority;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean isGroupRebalance() {
|
||||
return groupRebalance;
|
||||
}
|
||||
|
||||
public QueueConfiguration setGroupRebalance(Boolean groupRebalance) {
|
||||
this.groupRebalance = groupRebalance;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getGroupBuckets() {
|
||||
return groupBuckets;
|
||||
}
|
||||
|
||||
public QueueConfiguration setGroupBuckets(Integer groupBuckets) {
|
||||
this.groupBuckets = groupBuckets;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SimpleString getGroupFirstKey() {
|
||||
return groupFirstKey;
|
||||
}
|
||||
|
||||
public QueueConfiguration setGroupFirstKey(SimpleString groupFirstKey) {
|
||||
this.groupFirstKey = groupFirstKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueueConfiguration setGroupFirstKey(String groupFirstKey) {
|
||||
return setGroupFirstKey(SimpleString.toSimpleString(groupFirstKey));
|
||||
}
|
||||
|
||||
public Boolean isAutoDelete() {
|
||||
return autoDelete;
|
||||
}
|
||||
|
||||
public QueueConfiguration setAutoDelete(Boolean autoDelete) {
|
||||
this.autoDelete = autoDelete;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getAutoDeleteDelay() {
|
||||
return autoDeleteDelay;
|
||||
}
|
||||
|
||||
public QueueConfiguration setAutoDeleteDelay(Long autoDeleteDelay) {
|
||||
this.autoDeleteDelay = autoDeleteDelay;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getAutoDeleteMessageCount() {
|
||||
return autoDeleteMessageCount;
|
||||
}
|
||||
|
||||
public QueueConfiguration setAutoDeleteMessageCount(Long autoDeleteMessageCount) {
|
||||
this.autoDeleteMessageCount = autoDeleteMessageCount;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getRingSize() {
|
||||
return ringSize;
|
||||
}
|
||||
|
||||
public QueueConfiguration setRingSize(Long ringSize) {
|
||||
this.ringSize = ringSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* defaults to {@code false}
|
||||
* @return
|
||||
*/
|
||||
public Boolean isConfigurationManaged() {
|
||||
return configurationManaged == null ? false : configurationManaged;
|
||||
}
|
||||
|
||||
public QueueConfiguration setConfigurationManaged(Boolean configurationManaged) {
|
||||
this.configurationManaged = configurationManaged;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* defaults to {@code false}
|
||||
* @return
|
||||
*/
|
||||
public Boolean isTemporary() {
|
||||
return temporary == null ? false : temporary;
|
||||
}
|
||||
|
||||
public QueueConfiguration setTemporary(Boolean temporary) {
|
||||
this.temporary = temporary;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean isAutoCreateAddress() {
|
||||
return autoCreateAddress;
|
||||
}
|
||||
|
||||
public QueueConfiguration setAutoCreateAddress(Boolean autoCreateAddress) {
|
||||
this.autoCreateAddress = autoCreateAddress;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* defaults to {@code false}
|
||||
* @return
|
||||
*/
|
||||
public Boolean isInternal() {
|
||||
return internal == null ? false : internal;
|
||||
}
|
||||
|
||||
public QueueConfiguration setInternal(Boolean internal) {
|
||||
this.internal = internal;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* defaults to {@code false}
|
||||
* @return
|
||||
*/
|
||||
public Boolean isTransient() {
|
||||
return _transient == null ? false : _transient;
|
||||
}
|
||||
|
||||
public QueueConfiguration setTransient(Boolean _transient) {
|
||||
this._transient = _transient;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* defaults to {@code false}
|
||||
* @return
|
||||
*/
|
||||
public Boolean isAutoCreated() {
|
||||
return autoCreated == null ? false : autoCreated;
|
||||
}
|
||||
|
||||
public QueueConfiguration setAutoCreated(Boolean autoCreated) {
|
||||
this.autoCreated = autoCreated;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a JSON-formatted {@code String} representation of this {@code QueueConfiguration}. It is a
|
||||
* simple collection of key/value pairs. The keys used are referenced in {@link #set(String, String)}.
|
||||
*
|
||||
* @return a JSON-formatted {@code String} representation of this {@code QueueConfiguration}
|
||||
*/
|
||||
public String toJSON() {
|
||||
JsonObjectBuilder builder = JsonLoader.createObjectBuilder();
|
||||
|
||||
if (getId() != null) {
|
||||
builder.add(ID, getId());
|
||||
}
|
||||
if (getName() != null) {
|
||||
builder.add(NAME, getName().toString());
|
||||
}
|
||||
if (getAddress() != null) {
|
||||
builder.add(ADDRESS, getAddress().toString());
|
||||
}
|
||||
if (getRoutingType() != null) {
|
||||
builder.add(ROUTING_TYPE, getRoutingType().toString().toUpperCase());
|
||||
}
|
||||
if (getFilterString() != null) {
|
||||
builder.add(FILTER_STRING, getFilterString().toString());
|
||||
}
|
||||
if (isDurable() != null) {
|
||||
builder.add(DURABLE, isDurable());
|
||||
}
|
||||
if (getUser() != null) {
|
||||
builder.add(USER, getUser().toString());
|
||||
}
|
||||
if (getMaxConsumers() != null) {
|
||||
builder.add(MAX_CONSUMERS, getMaxConsumers());
|
||||
}
|
||||
if (isExclusive() != null) {
|
||||
builder.add(EXCLUSIVE, isExclusive());
|
||||
}
|
||||
if (isGroupRebalance() != null) {
|
||||
builder.add(GROUP_REBALANCE, isGroupRebalance());
|
||||
}
|
||||
if (getGroupBuckets() != null) {
|
||||
builder.add(GROUP_BUCKETS, getGroupBuckets());
|
||||
}
|
||||
if (getGroupFirstKey() != null) {
|
||||
builder.add(GROUP_FIRST_KEY, getGroupFirstKey().toString());
|
||||
}
|
||||
if (isLastValue() != null) {
|
||||
builder.add(LAST_VALUE, isLastValue());
|
||||
}
|
||||
if (getLastValueKey() != null) {
|
||||
builder.add(LAST_VALUE_KEY, getLastValueKey().toString());
|
||||
}
|
||||
if (isNonDestructive() != null) {
|
||||
builder.add(NON_DESTRUCTIVE, isNonDestructive());
|
||||
}
|
||||
if (isPurgeOnNoConsumers() != null) {
|
||||
builder.add(PURGE_ON_NO_CONSUMERS, isPurgeOnNoConsumers());
|
||||
}
|
||||
if (getConsumersBeforeDispatch() != null) {
|
||||
builder.add(CONSUMERS_BEFORE_DISPATCH, getConsumersBeforeDispatch());
|
||||
}
|
||||
if (getDelayBeforeDispatch() != null) {
|
||||
builder.add(DELAY_BEFORE_DISPATCH, getDelayBeforeDispatch());
|
||||
}
|
||||
if (getConsumerPriority() != null) {
|
||||
builder.add(CONSUMER_PRIORITY, getConsumerPriority());
|
||||
}
|
||||
if (isAutoDelete() != null) {
|
||||
builder.add(AUTO_DELETE, isAutoDelete());
|
||||
}
|
||||
if (getAutoDeleteDelay() != null) {
|
||||
builder.add(AUTO_DELETE_DELAY, getAutoDeleteDelay());
|
||||
}
|
||||
if (getAutoDeleteMessageCount() != null) {
|
||||
builder.add(AUTO_DELETE_MESSAGE_COUNT, getAutoDeleteMessageCount());
|
||||
}
|
||||
if (getRingSize() != null) {
|
||||
builder.add(RING_SIZE, getRingSize());
|
||||
}
|
||||
if (isConfigurationManaged() != null) {
|
||||
builder.add(CONFIGURATION_MANAGED, isConfigurationManaged());
|
||||
}
|
||||
if (isTemporary() != null) {
|
||||
builder.add(TEMPORARY, isTemporary());
|
||||
}
|
||||
if (isAutoCreateAddress() != null) {
|
||||
builder.add(AUTO_CREATE_ADDRESS, isAutoCreateAddress());
|
||||
}
|
||||
if (isInternal() != null) {
|
||||
builder.add(INTERNAL, isInternal());
|
||||
}
|
||||
if (isTransient() != null) {
|
||||
builder.add(TRANSIENT, isTransient());
|
||||
}
|
||||
if (isAutoCreated() != null) {
|
||||
builder.add(AUTO_CREATED, isAutoCreated());
|
||||
}
|
||||
|
||||
return builder.build().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a {@code QueueConfiguration} created from the JSON-formatted input {@code String}. The input
|
||||
* should be a simple object of key/value pairs. Valid keys are referenced in {@link #set(String, String)}.
|
||||
*
|
||||
* @param jsonString
|
||||
* @return the {@code QueueConfiguration} created from the JSON-formatted input {@code String}
|
||||
*/
|
||||
public static QueueConfiguration fromJSON(String jsonString) {
|
||||
JsonObject json = JsonLoader.createReader(new StringReader(jsonString)).readObject();
|
||||
|
||||
// name is the only required value
|
||||
if (!json.keySet().contains(NAME)) {
|
||||
return null;
|
||||
}
|
||||
QueueConfiguration result = new QueueConfiguration(json.getString(NAME));
|
||||
|
||||
for (Map.Entry<String, JsonValue> entry : json.entrySet()) {
|
||||
result.set(entry.getKey(), entry.getValue().getValueType() == JsonValue.ValueType.STRING ? ((JsonString)entry.getValue()).getString() : entry.getValue().toString());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
|
||||
QueueConfiguration that = (QueueConfiguration) o;
|
||||
|
||||
if (!Objects.equals(id, that.id))
|
||||
return false;
|
||||
if (!Objects.equals(name, that.name))
|
||||
return false;
|
||||
if (!Objects.equals(address, that.address))
|
||||
return false;
|
||||
if (!Objects.equals(routingType, that.routingType))
|
||||
return false;
|
||||
if (!Objects.equals(filterString, that.filterString))
|
||||
return false;
|
||||
if (!Objects.equals(durable, that.durable))
|
||||
return false;
|
||||
if (!Objects.equals(user, that.user))
|
||||
return false;
|
||||
if (!Objects.equals(maxConsumers, that.maxConsumers))
|
||||
return false;
|
||||
if (!Objects.equals(exclusive, that.exclusive))
|
||||
return false;
|
||||
if (!Objects.equals(groupRebalance, that.groupRebalance))
|
||||
return false;
|
||||
if (!Objects.equals(groupBuckets, that.groupBuckets))
|
||||
return false;
|
||||
if (!Objects.equals(groupFirstKey, that.groupFirstKey))
|
||||
return false;
|
||||
if (!Objects.equals(lastValue, that.lastValue))
|
||||
return false;
|
||||
if (!Objects.equals(lastValueKey, that.lastValueKey))
|
||||
return false;
|
||||
if (!Objects.equals(nonDestructive, that.nonDestructive))
|
||||
return false;
|
||||
if (!Objects.equals(purgeOnNoConsumers, that.purgeOnNoConsumers))
|
||||
return false;
|
||||
if (!Objects.equals(consumersBeforeDispatch, that.consumersBeforeDispatch))
|
||||
return false;
|
||||
if (!Objects.equals(delayBeforeDispatch, that.delayBeforeDispatch))
|
||||
return false;
|
||||
if (!Objects.equals(consumerPriority, that.consumerPriority))
|
||||
return false;
|
||||
if (!Objects.equals(autoDelete, that.autoDelete))
|
||||
return false;
|
||||
if (!Objects.equals(autoDeleteDelay, that.autoDeleteDelay))
|
||||
return false;
|
||||
if (!Objects.equals(autoDeleteMessageCount, that.autoDeleteMessageCount))
|
||||
return false;
|
||||
if (!Objects.equals(ringSize, that.ringSize))
|
||||
return false;
|
||||
if (!Objects.equals(configurationManaged, that.configurationManaged))
|
||||
return false;
|
||||
if (!Objects.equals(temporary, that.temporary))
|
||||
return false;
|
||||
if (!Objects.equals(autoCreateAddress, that.autoCreateAddress))
|
||||
return false;
|
||||
if (!Objects.equals(internal, that.internal))
|
||||
return false;
|
||||
if (!Objects.equals(_transient, that._transient))
|
||||
return false;
|
||||
if (!Objects.equals(autoCreated, that.autoCreated))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = Objects.hashCode(id);
|
||||
result = 31 * result + Objects.hashCode(name);
|
||||
result = 31 * result + Objects.hashCode(address);
|
||||
result = 31 * result + Objects.hashCode(routingType);
|
||||
result = 31 * result + Objects.hashCode(filterString);
|
||||
result = 31 * result + Objects.hashCode(durable);
|
||||
result = 31 * result + Objects.hashCode(user);
|
||||
result = 31 * result + Objects.hashCode(maxConsumers);
|
||||
result = 31 * result + Objects.hashCode(exclusive);
|
||||
result = 31 * result + Objects.hashCode(groupRebalance);
|
||||
result = 31 * result + Objects.hashCode(groupBuckets);
|
||||
result = 31 * result + Objects.hashCode(groupFirstKey);
|
||||
result = 31 * result + Objects.hashCode(lastValue);
|
||||
result = 31 * result + Objects.hashCode(lastValueKey);
|
||||
result = 31 * result + Objects.hashCode(nonDestructive);
|
||||
result = 31 * result + Objects.hashCode(purgeOnNoConsumers);
|
||||
result = 31 * result + Objects.hashCode(consumersBeforeDispatch);
|
||||
result = 31 * result + Objects.hashCode(delayBeforeDispatch);
|
||||
result = 31 * result + Objects.hashCode(consumerPriority);
|
||||
result = 31 * result + Objects.hashCode(autoDelete);
|
||||
result = 31 * result + Objects.hashCode(autoDeleteDelay);
|
||||
result = 31 * result + Objects.hashCode(autoDeleteMessageCount);
|
||||
result = 31 * result + Objects.hashCode(ringSize);
|
||||
result = 31 * result + Objects.hashCode(configurationManaged);
|
||||
result = 31 * result + Objects.hashCode(temporary);
|
||||
result = 31 * result + Objects.hashCode(autoCreateAddress);
|
||||
result = 31 * result + Objects.hashCode(internal);
|
||||
result = 31 * result + Objects.hashCode(_transient);
|
||||
result = 31 * result + Objects.hashCode(autoCreated);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "QueueConfiguration ["
|
||||
+ "id=" + id
|
||||
+ ", name=" + name
|
||||
+ ", address=" + address
|
||||
+ ", routingType=" + routingType
|
||||
+ ", filterString=" + filterString
|
||||
+ ", durable=" + durable
|
||||
+ ", user=" + user
|
||||
+ ", maxConsumers=" + maxConsumers
|
||||
+ ", exclusive=" + exclusive
|
||||
+ ", groupRebalance=" + groupRebalance
|
||||
+ ", groupBuckets=" + groupBuckets
|
||||
+ ", groupFirstKey=" + groupFirstKey
|
||||
+ ", lastValue=" + lastValue
|
||||
+ ", lastValueKey=" + lastValueKey
|
||||
+ ", nonDestructive=" + nonDestructive
|
||||
+ ", purgeOnNoConsumers=" + purgeOnNoConsumers
|
||||
+ ", consumersBeforeDispatch=" + consumersBeforeDispatch
|
||||
+ ", delayBeforeDispatch=" + delayBeforeDispatch
|
||||
+ ", consumerPriority=" + consumerPriority
|
||||
+ ", autoDelete=" + autoDelete
|
||||
+ ", autoDeleteDelay=" + autoDeleteDelay
|
||||
+ ", autoDeleteMessageCount=" + autoDeleteMessageCount
|
||||
+ ", ringSize=" + ringSize
|
||||
+ ", configurationManaged=" + configurationManaged
|
||||
+ ", temporary=" + temporary
|
||||
+ ", autoCreateAddress=" + autoCreateAddress
|
||||
+ ", internal=" + internal
|
||||
+ ", transient=" + _transient
|
||||
+ ", autoCreated=" + autoCreated + ']';
|
||||
}
|
||||
}
|
|
@ -34,6 +34,10 @@ public class CompositeAddress {
|
|||
return address == null ? false : address.contains(SEPARATOR);
|
||||
}
|
||||
|
||||
public static boolean isFullyQualified(SimpleString address) {
|
||||
return address == null ? false : isFullyQualified(address.toString());
|
||||
}
|
||||
|
||||
public static SimpleString extractQueueName(SimpleString name) {
|
||||
if (name == null) {
|
||||
return null;
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.activemq.artemis.api.core.client;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.client.impl.ClientMessageImpl;
|
||||
|
||||
|
@ -51,7 +52,7 @@ public final class ClientRequestor implements AutoCloseable {
|
|||
|
||||
requestProducer = queueSession.createProducer(requestAddress);
|
||||
replyQueue = new SimpleString(requestAddress + "." + UUID.randomUUID().toString());
|
||||
queueSession.createTemporaryQueue(replyQueue, replyQueue);
|
||||
queueSession.createQueue(new QueueConfiguration(replyQueue).setDurable(false).setTemporary(true));
|
||||
replyConsumer = queueSession.createConsumer(replyQueue);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Set;
|
|||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueAttributes;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
|
||||
|
@ -272,6 +273,66 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
|
||||
// Queue Operations ----------------------------------------------
|
||||
|
||||
/**
|
||||
* This method creates a queue based on the {@link QueueConfiguration} input. See {@link QueueConfiguration} for more
|
||||
* details on configuration specifics.
|
||||
* <p>
|
||||
* Some static defaults will be enforced for properties which are not set on the {@code QueueConfiguration}:
|
||||
* <p><ul>
|
||||
* <li>{@code transient} : {@code false}
|
||||
* <li>{@code temporary} : {@code false}
|
||||
* <li>{@code durable} : {@code true}
|
||||
* <li>{@code autoCreated} : {@code false}
|
||||
* <li>{@code internal} : {@code false}
|
||||
* <li>{@code configurationManaged} : {@code false}
|
||||
* <li>{@code maxConsumers} : {@link org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration#getDefaultMaxQueueConsumers()}
|
||||
* <li>{@code purgeOnNoConsumers} : {@link org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration#getDefaultPurgeOnNoConsumers()}
|
||||
* </ul><p>
|
||||
* Some dynamic defaults will be enforced via address-settings for the corresponding unset properties:
|
||||
* <p><ul>
|
||||
* <li>{@code exclusive}
|
||||
* <li>{@code groupRebalance}
|
||||
* <li>{@code groupBuckets}
|
||||
* <li>{@code groupFirstKey}
|
||||
* <li>{@code lastValue}
|
||||
* <li>{@code lastValueKey}
|
||||
* <li>{@code nonDestructive}
|
||||
* <li>{@code consumersBeforeDispatch}
|
||||
* <li>{@code delayBeforeDispatch}
|
||||
* <li>{@code ringSize}
|
||||
* <li>{@code routingType}
|
||||
* <li>{@code autoCreateAddress}
|
||||
* <li>{@code autoDelete} (only set if queue was auto-created)
|
||||
* <li>{@code autoDeleteDelay}
|
||||
* <li>{@code autoDeleteMessageCount}
|
||||
* </ul><p>
|
||||
*
|
||||
* @param queueConfiguration the configuration to use when creating the queue
|
||||
* @return the {@code Queue} instance that was created
|
||||
* @throws Exception
|
||||
*/
|
||||
void createQueue(QueueConfiguration queueConfiguration) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
* This method is essentially the same as {@link #createQueue(QueueConfiguration)} with a few key exceptions.
|
||||
* <p>
|
||||
* If {@code durable} is {@code true} then:
|
||||
* <p><ul>
|
||||
* <li>{@code transient} will be forced to {@code false}
|
||||
* <li>{@code temporary} will be forced to {@code false}
|
||||
* </ul><p>
|
||||
* If {@code durable} is {@code false} then:
|
||||
* <p><ul>
|
||||
* <li>{@code transient} will be forced to {@code true}
|
||||
* <li>{@code temporary} will be forced to {@code true}
|
||||
* </ul><p>
|
||||
* In all instances {@code autoCreated} will be forced to {@code false} and {@code autoCreatedAddress} will be forced
|
||||
* to {@code true}.
|
||||
*
|
||||
* @see #createQueue(QueueConfiguration)
|
||||
*/
|
||||
void createSharedQueue(QueueConfiguration queueConfiguration) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
* Creates a <em>non-temporary</em> queue.
|
||||
*
|
||||
|
@ -457,6 +518,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param durable whether the queue is durable or not
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, boolean durable) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
|
@ -470,6 +532,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param durable if the queue is durable
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString queueName, boolean durable) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
|
@ -484,6 +547,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param durable if the queue is durable
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
boolean durable) throws ActiveMQException;
|
||||
|
||||
|
@ -501,6 +565,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param lastValue if the queue is last value queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
boolean durable, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException;
|
||||
|
||||
|
@ -512,6 +577,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param queueAttributes attributes for the queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createSharedQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes) throws ActiveMQException;
|
||||
|
||||
|
||||
|
@ -524,6 +590,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param durable whether the queue is durable or not
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createQueue(String address, RoutingType routingType, String queueName, boolean durable) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
|
@ -534,6 +601,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param queueName the name of the queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createQueue(String address, RoutingType routingType, String queueName) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
|
@ -544,6 +612,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param queueName the name of the queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
|
@ -556,6 +625,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param durable whether the queue is durable or not
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
boolean durable) throws ActiveMQException;
|
||||
|
||||
|
@ -569,6 +639,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param durable whether the queue is durable or not
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
|
@ -582,6 +653,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param autoCreated whether to mark this queue as autoCreated or not
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
boolean durable, boolean autoCreated) throws ActiveMQException;
|
||||
|
||||
|
@ -598,6 +670,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param purgeOnNoConsumers whether to delete the contents of the queue when the last consumer disconnects
|
||||
* @throws ActiveMQException
|
||||
*/
|
||||
@Deprecated
|
||||
void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers) throws ActiveMQException;
|
||||
|
||||
|
@ -616,6 +689,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param lastValue whether the queue should be lastValue
|
||||
* @throws ActiveMQException
|
||||
*/
|
||||
@Deprecated
|
||||
void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException;
|
||||
|
||||
|
@ -628,6 +702,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param queueAttributes attributes for the queue
|
||||
* @throws ActiveMQException
|
||||
*/
|
||||
@Deprecated
|
||||
void createQueue(SimpleString address, SimpleString queueName, boolean autoCreated, QueueAttributes queueAttributes) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
|
@ -641,6 +716,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param autoCreated whether to mark this queue as autoCreated or not
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
|
@ -656,6 +732,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param purgeOnNoConsumers whether to delete the contents of the queue when the last consumer disconnects
|
||||
* @throws ActiveMQException
|
||||
*/
|
||||
@Deprecated
|
||||
void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated,
|
||||
int maxConsumers, boolean purgeOnNoConsumers) throws ActiveMQException;
|
||||
|
||||
|
@ -674,6 +751,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param lastValue whether the queue should be lastValue
|
||||
* @throws ActiveMQException
|
||||
*/
|
||||
@Deprecated
|
||||
void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated,
|
||||
int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException;
|
||||
|
||||
|
@ -685,6 +763,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param queueName the name of the queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createTemporaryQueue(SimpleString address, RoutingType routingType, SimpleString queueName) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
|
@ -695,6 +774,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param queueName the name of the queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createTemporaryQueue(String address, RoutingType routingType, String queueName) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
|
@ -710,6 +790,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param lastValue if the queue is last value queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createTemporaryQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, int maxConsumers,
|
||||
boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException;
|
||||
|
||||
|
@ -721,6 +802,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param queueAttributes attributes for the queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createTemporaryQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
|
@ -732,6 +814,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param filter only messages which match this filter will be put in the queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createTemporaryQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
|
@ -743,6 +826,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
|
|||
* @param filter only messages which match this filter will be put in the queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
void createTemporaryQueue(String address, RoutingType routingType, String queueName, String filter) throws ActiveMQException;
|
||||
|
||||
/**
|
||||
|
|
|
@ -506,6 +506,7 @@ public interface ActiveMQServerControl {
|
|||
* @param name name of the queue
|
||||
* @param routingType The routing type used for this address, MULTICAST or ANYCAST
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Create a queue with the specified address", impact = MBeanOperationInfo.ACTION)
|
||||
void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
|
||||
@Parameter(name = "name", desc = "Name of the queue") String name,
|
||||
|
@ -540,6 +541,7 @@ public interface ActiveMQServerControl {
|
|||
* @param durable whether the queue is durable
|
||||
* @param routingType The routing type used for this address, MULTICAST or ANYCAST
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Create a queue with the specified address, name and durability", impact = MBeanOperationInfo.ACTION)
|
||||
void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
|
||||
@Parameter(name = "name", desc = "Name of the queue") String name,
|
||||
|
@ -558,6 +560,7 @@ public interface ActiveMQServerControl {
|
|||
* @param filter of the queue
|
||||
* @param durable whether the queue is durable
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION)
|
||||
void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
|
||||
@Parameter(name = "name", desc = "Name of the queue") String name,
|
||||
|
@ -577,6 +580,7 @@ public interface ActiveMQServerControl {
|
|||
* @param durable whether the queue is durable
|
||||
* @param routingType The routing type used for this address, MULTICAST or ANYCAST
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION)
|
||||
void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
|
||||
@Parameter(name = "name", desc = "Name of the queue") String name,
|
||||
|
@ -606,6 +610,7 @@ public interface ActiveMQServerControl {
|
|||
* @return a textual summary of the queue
|
||||
* @throws Exception
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION)
|
||||
String createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
|
||||
@Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType,
|
||||
|
@ -647,6 +652,7 @@ public interface ActiveMQServerControl {
|
|||
* @return a textual summary of the queue
|
||||
* @throws Exception
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION)
|
||||
String createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
|
||||
@Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType,
|
||||
|
@ -690,6 +696,7 @@ public interface ActiveMQServerControl {
|
|||
* @return a textual summary of the queue
|
||||
* @throws Exception
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION)
|
||||
String createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
|
||||
@Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType,
|
||||
|
@ -735,6 +742,7 @@ public interface ActiveMQServerControl {
|
|||
* @return a textual summary of the queue
|
||||
* @throws Exception
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION)
|
||||
String createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
|
||||
@Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType,
|
||||
|
@ -776,6 +784,7 @@ public interface ActiveMQServerControl {
|
|||
* @return a textual summary of the queue
|
||||
* @throws Exception
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION)
|
||||
String createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
|
||||
@Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType,
|
||||
|
@ -785,7 +794,42 @@ public interface ActiveMQServerControl {
|
|||
@Parameter(name = "maxConsumers", desc = "The maximum number of consumers allowed on this queue at any one time") int maxConsumers,
|
||||
@Parameter(name = "purgeOnNoConsumers", desc = "Delete this queue when the last consumer disconnects") boolean purgeOnNoConsumers,
|
||||
@Parameter(name = "autoCreateAddress", desc = "Create an address with default values should a matching address not be found") boolean autoCreateAddress) throws Exception;
|
||||
/**
|
||||
* Create a queue.
|
||||
* <br>
|
||||
* This method throws a {@link org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException}) exception if the queue already exists.
|
||||
*
|
||||
* @param queueConfiguration the configuration of the queue in JSON format
|
||||
* @return the configuration of the created queue in JSON format
|
||||
* @throws Exception
|
||||
*/
|
||||
@Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION)
|
||||
String createQueue(@Parameter(name = "queueConfiguration", desc = "the configuration of the queue in JSON format") String queueConfiguration) throws Exception;
|
||||
|
||||
/**
|
||||
* Create a queue.
|
||||
* <br>
|
||||
* This method throws a {@link org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException}) exception if the queue already exists and {@code ignoreIfExists} is {@code false}.
|
||||
*
|
||||
* @param queueConfiguration the configuration of the queue in JSON format
|
||||
* @param ignoreIfExists whether or not to simply return without an exception if the queue exists
|
||||
* @return the configuration of the created queue in JSON format
|
||||
* @throws Exception
|
||||
*/
|
||||
@Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION)
|
||||
String createQueue(@Parameter(name = "queueConfiguration", desc = "the configuration of the queue in JSON format") String queueConfiguration,
|
||||
@Parameter(name = "ignoreIfExists", desc = "whether or not to try to create the queue if it exists already") boolean ignoreIfExists) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Update a queue.
|
||||
*
|
||||
* @param queueConfiguration the configuration of the queue in JSON format
|
||||
* @return the configuration of the created queue in JSON format
|
||||
* @throws Exception
|
||||
*/
|
||||
@Operation(desc = "Update a queue", impact = MBeanOperationInfo.ACTION)
|
||||
String updateQueue(@Parameter(name = "queueConfiguration", desc = "the configuration of the queue in JSON format") String queueConfiguration) throws Exception;
|
||||
|
||||
/**
|
||||
* Update a queue.
|
||||
|
@ -835,6 +879,7 @@ public interface ActiveMQServerControl {
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Update a queue", impact = MBeanOperationInfo.ACTION)
|
||||
String updateQueue(@Parameter(name = "name", desc = "Name of the queue") String name,
|
||||
@Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType,
|
||||
|
@ -861,6 +906,7 @@ public interface ActiveMQServerControl {
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Update a queue", impact = MBeanOperationInfo.ACTION)
|
||||
String updateQueue(@Parameter(name = "name", desc = "Name of the queue") String name,
|
||||
@Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType,
|
||||
|
@ -894,6 +940,7 @@ public interface ActiveMQServerControl {
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Update a queue", impact = MBeanOperationInfo.ACTION)
|
||||
String updateQueue(@Parameter(name = "name", desc = "Name of the queue") String name,
|
||||
@Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType,
|
||||
|
@ -929,6 +976,7 @@ public interface ActiveMQServerControl {
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Update a queue", impact = MBeanOperationInfo.ACTION)
|
||||
String updateQueue(@Parameter(name = "name", desc = "Name of the queue") String name,
|
||||
@Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType,
|
||||
|
@ -956,6 +1004,7 @@ public interface ActiveMQServerControl {
|
|||
* @param name name of the queue
|
||||
* @param filter of the queue
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Deploy a queue", impact = MBeanOperationInfo.ACTION)
|
||||
void deployQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
|
||||
@Parameter(name = "name", desc = "Name of the queue") String name,
|
||||
|
@ -973,6 +1022,7 @@ public interface ActiveMQServerControl {
|
|||
* @param filter of the queue
|
||||
* @param durable whether the queue is durable
|
||||
*/
|
||||
@Deprecated
|
||||
@Operation(desc = "Deploy a queue", impact = MBeanOperationInfo.ACTION)
|
||||
void deployQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
|
||||
@Parameter(name = "name", desc = "Name of the queue") String name,
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueAttributes;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
|
@ -298,6 +299,23 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
createAddress(address, EnumSet.of(routingType), autoCreated);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createQueue(QueueConfiguration queueConfiguration) throws ActiveMQException {
|
||||
internalCreateQueue(queueConfiguration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createSharedQueue(QueueConfiguration queueConfiguration) throws ActiveMQException {
|
||||
checkClosed();
|
||||
|
||||
startCall();
|
||||
try {
|
||||
sessionContext.createSharedQueue(queueConfiguration);
|
||||
} finally {
|
||||
endCall();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createQueue(final SimpleString address,
|
||||
final SimpleString queueName,
|
||||
|
@ -363,6 +381,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
/** New Queue API **/
|
||||
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createQueue(final SimpleString address,
|
||||
final RoutingType routingType,
|
||||
|
@ -394,6 +413,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createQueue(final SimpleString address, final RoutingType routingType, final SimpleString queueName, final SimpleString filterString,
|
||||
final boolean durable, final boolean autoCreated, final int maxConsumers, final boolean purgeOnNoConsumers) throws ActiveMQException {
|
||||
|
@ -409,6 +429,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
.setPurgeOnNoConsumers(purgeOnNoConsumers));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createQueue(final SimpleString address, final RoutingType routingType, final SimpleString queueName, final SimpleString filterString,
|
||||
final boolean durable, final boolean autoCreated, final int maxConsumers, final boolean purgeOnNoConsumers, final Boolean exclusive, final Boolean lastValue) throws ActiveMQException {
|
||||
|
@ -426,6 +447,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
.setLastValue(lastValue));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createQueue(final SimpleString address, final SimpleString queueName, final boolean autoCreated, final QueueAttributes queueAttributes) throws ActiveMQException {
|
||||
internalCreateQueue(address,
|
||||
|
@ -435,6 +457,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
queueAttributes);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createQueue(final String address, final RoutingType routingType, final String queueName, final String filterString,
|
||||
final boolean durable, final boolean autoCreated, final int maxConsumers, final boolean purgeOnNoConsumers) throws ActiveMQException {
|
||||
|
@ -477,6 +500,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
createTemporaryQueue(SimpleString.toSimpleString(address), routingType, SimpleString.toSimpleString(queueName));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createTemporaryQueue(final SimpleString address,
|
||||
final RoutingType routingType,
|
||||
|
@ -500,6 +524,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
.setLastValue(lastValue));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createTemporaryQueue(final SimpleString address,
|
||||
final SimpleString queueName,
|
||||
|
@ -511,6 +536,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
queueAttributes);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createTemporaryQueue(final SimpleString address,
|
||||
final RoutingType routingType,
|
||||
|
@ -533,6 +559,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
* @param durable whether the queue is durable or not
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, boolean durable) throws ActiveMQException {
|
||||
internalCreateQueue(address,
|
||||
|
@ -595,6 +622,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
* @param lastValue if the queue is last value queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
boolean durable, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException {
|
||||
|
@ -617,16 +645,10 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
* @param queueAttributes attributes for the queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes) throws ActiveMQException {
|
||||
checkClosed();
|
||||
|
||||
startCall();
|
||||
try {
|
||||
sessionContext.createSharedQueue(address, queueName, queueAttributes);
|
||||
} finally {
|
||||
endCall();
|
||||
}
|
||||
createSharedQueue(queueAttributes.toQueueConfiguration().setName(queueName).setAddress(address));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -651,6 +673,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
* @param queueName the name of the queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createQueue(String address, RoutingType routingType, String queueName) throws ActiveMQException {
|
||||
internalCreateQueue(SimpleString.toSimpleString(address),
|
||||
|
@ -673,6 +696,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
* @param queueName the name of the queue
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName) throws ActiveMQException {
|
||||
internalCreateQueue(address,
|
||||
|
@ -697,6 +721,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
* @param durable whether the queue is durable or not
|
||||
* @throws ActiveMQException in an exception occurs while creating the queue
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
boolean durable) throws ActiveMQException {
|
||||
|
@ -1992,24 +2017,25 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
return producer;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private void internalCreateQueue(final SimpleString address,
|
||||
final SimpleString queueName,
|
||||
final boolean temp,
|
||||
final boolean autoCreated,
|
||||
final QueueAttributes queueAttributes) throws ActiveMQException {
|
||||
internalCreateQueue(queueAttributes.toQueueConfiguration().setName(queueName).setAddress(address).setTemporary(temp).setAutoCreated(autoCreated));
|
||||
}
|
||||
|
||||
private void internalCreateQueue(final QueueConfiguration queueConfiguration) throws ActiveMQException {
|
||||
checkClosed();
|
||||
|
||||
if (queueAttributes.getDurable() && temp) {
|
||||
if (queueConfiguration.isDurable() && queueConfiguration.isTemporary()) {
|
||||
throw ActiveMQClientMessageBundle.BUNDLE.queueMisConfigured();
|
||||
}
|
||||
|
||||
startCall();
|
||||
try {
|
||||
sessionContext.createQueue(address,
|
||||
queueName,
|
||||
temp,
|
||||
autoCreated,
|
||||
queueAttributes);
|
||||
sessionContext.createQueue(queueConfiguration);
|
||||
} finally {
|
||||
endCall();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
|
|||
import org.apache.activemq.artemis.api.core.ICoreMessage;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueAttributes;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.DISCONNECT_CONSUMER;
|
||||
|
@ -281,6 +282,7 @@ public class ActiveMQSessionContext extends SessionContext {
|
|||
return this.sendAckHandler;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(SimpleString address,
|
||||
SimpleString queueName,
|
||||
|
@ -291,58 +293,54 @@ public class ActiveMQSessionContext extends SessionContext {
|
|||
Boolean purgeOnNoConsumers,
|
||||
Boolean exclusive,
|
||||
Boolean lastValue) throws ActiveMQException {
|
||||
QueueAttributes queueAttributes = new QueueAttributes()
|
||||
.setRoutingType(routingType)
|
||||
.setFilterString(filterString)
|
||||
.setDurable(durable)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setLastValue(lastValue);
|
||||
createSharedQueue(address, queueName, queueAttributes);
|
||||
createSharedQueue(new QueueConfiguration(queueName)
|
||||
.setAddress(address)
|
||||
.setRoutingType(routingType)
|
||||
.setFilterString(filterString)
|
||||
.setDurable(durable)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setLastValue(lastValue));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(SimpleString address,
|
||||
SimpleString queueName,
|
||||
QueueAttributes queueAttributes) throws ActiveMQException {
|
||||
sessionChannel.sendBlocking(new CreateSharedQueueMessage_V2(address, queueName,
|
||||
queueAttributes.getRoutingType(),
|
||||
queueAttributes.getFilterString(),
|
||||
queueAttributes.getDurable(),
|
||||
queueAttributes.getMaxConsumers(),
|
||||
queueAttributes.getPurgeOnNoConsumers(),
|
||||
queueAttributes.getExclusive(),
|
||||
queueAttributes.getGroupRebalance(),
|
||||
queueAttributes.getGroupBuckets(),
|
||||
queueAttributes.getGroupFirstKey(),
|
||||
queueAttributes.getLastValue(),
|
||||
queueAttributes.getLastValueKey(),
|
||||
queueAttributes.getNonDestructive(),
|
||||
queueAttributes.getConsumersBeforeDispatch(),
|
||||
queueAttributes.getDelayBeforeDispatch(),
|
||||
queueAttributes.getAutoDelete(),
|
||||
queueAttributes.getAutoDeleteDelay(),
|
||||
queueAttributes.getAutoDeleteMessageCount(),
|
||||
true), PacketImpl.NULL_RESPONSE);
|
||||
createSharedQueue(queueAttributes.toQueueConfiguration().setName(queueName).setAddress(address));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createSharedQueue(QueueConfiguration queueConfiguration) throws ActiveMQException {
|
||||
sessionChannel.sendBlocking(new CreateSharedQueueMessage_V2(queueConfiguration, true), PacketImpl.NULL_RESPONSE);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(SimpleString address,
|
||||
SimpleString queueName,
|
||||
RoutingType routingType,
|
||||
SimpleString filterString,
|
||||
boolean durable) throws ActiveMQException {
|
||||
createSharedQueue(address, queueName, routingType, filterString, durable, null, null, null, null);
|
||||
createSharedQueue(new QueueConfiguration(queueName)
|
||||
.setAddress(address)
|
||||
.setRoutingType(routingType)
|
||||
.setFilterString(filterString)
|
||||
.setDurable(durable));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(SimpleString address,
|
||||
SimpleString queueName,
|
||||
SimpleString filterString,
|
||||
boolean durable) throws ActiveMQException {
|
||||
createSharedQueue(address, queueName, null, filterString, durable);
|
||||
createSharedQueue(new QueueConfiguration(queueName)
|
||||
.setAddress(address)
|
||||
.setFilterString(filterString)
|
||||
.setDurable(durable));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -734,24 +732,30 @@ public class ActiveMQSessionContext extends SessionContext {
|
|||
boolean durable,
|
||||
boolean temp,
|
||||
boolean autoCreated) throws ActiveMQException {
|
||||
createQueue(address, ActiveMQDefaultConfiguration.getDefaultRoutingType(), queueName, filterString, durable, temp, ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(), ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), autoCreated);
|
||||
createQueue(new QueueConfiguration(queueName)
|
||||
.setAddress(address)
|
||||
.setFilterString(filterString)
|
||||
.setDurable(durable)
|
||||
.setTemporary(temp)
|
||||
.setAutoCreated(autoCreated));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createQueue(SimpleString address,
|
||||
SimpleString queueName,
|
||||
boolean temp,
|
||||
boolean autoCreated,
|
||||
QueueAttributes queueAttributes) throws ActiveMQException {
|
||||
if (sessionChannel.getConnection().isVersionBeforeAddressChange()) {
|
||||
CreateQueueMessage request = new CreateQueueMessage(address, queueName, queueAttributes.getFilterString(), queueAttributes.getDurable(), temp, true);
|
||||
sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE);
|
||||
} else {
|
||||
CreateQueueMessage request = new CreateQueueMessage_V2(address, queueName, temp, autoCreated, true, queueAttributes);
|
||||
sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE);
|
||||
}
|
||||
createQueue(queueAttributes
|
||||
.toQueueConfiguration()
|
||||
.setName(queueName)
|
||||
.setAddress(address)
|
||||
.setTemporary(temp)
|
||||
.setAutoCreated(autoCreated));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createQueue(SimpleString address,
|
||||
RoutingType routingType,
|
||||
|
@ -764,19 +768,17 @@ public class ActiveMQSessionContext extends SessionContext {
|
|||
boolean autoCreated,
|
||||
Boolean exclusive,
|
||||
Boolean lastValue) throws ActiveMQException {
|
||||
createQueue(
|
||||
address,
|
||||
queueName,
|
||||
temp,
|
||||
autoCreated,
|
||||
new QueueAttributes()
|
||||
.setRoutingType(routingType)
|
||||
.setFilterString(filterString)
|
||||
.setDurable(durable)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setLastValue(lastValue));
|
||||
createQueue(new QueueConfiguration(queueName)
|
||||
.setAddress(address)
|
||||
.setTemporary(temp)
|
||||
.setAutoCreated(autoCreated)
|
||||
.setRoutingType(routingType)
|
||||
.setFilterString(filterString)
|
||||
.setDurable(durable)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setLastValue(lastValue));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -790,7 +792,34 @@ public class ActiveMQSessionContext extends SessionContext {
|
|||
int maxConsumers,
|
||||
boolean purgeOnNoConsumers,
|
||||
boolean autoCreated) throws ActiveMQException {
|
||||
createQueue(address, routingType, queueName, filterString, durable, temp, maxConsumers, purgeOnNoConsumers, autoCreated, null, null);
|
||||
createQueue(new QueueConfiguration(queueName)
|
||||
.setAddress(address)
|
||||
.setRoutingType(routingType)
|
||||
.setFilterString(filterString)
|
||||
.setDurable(durable)
|
||||
.setTemporary(temp)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setAutoCreated(autoCreated));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createQueue(QueueConfiguration queueConfiguration) throws ActiveMQException {
|
||||
// Set the non nullable (CreateQueueMessage_V2) queue attributes (all others have static defaults or get defaulted if null by address settings server side).
|
||||
if (queueConfiguration.getMaxConsumers() == null) {
|
||||
queueConfiguration.setMaxConsumers(ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers());
|
||||
}
|
||||
if (queueConfiguration.isPurgeOnNoConsumers() == null) {
|
||||
queueConfiguration.setPurgeOnNoConsumers(ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers());
|
||||
}
|
||||
|
||||
if (sessionChannel.getConnection().isVersionBeforeAddressChange()) {
|
||||
CreateQueueMessage request = new CreateQueueMessage(queueConfiguration, true);
|
||||
sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE);
|
||||
} else {
|
||||
CreateQueueMessage request = new CreateQueueMessage_V2(queueConfiguration, true);
|
||||
sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.activemq.artemis.core.protocol.core.impl.wireformat;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl;
|
||||
|
||||
|
@ -34,6 +35,10 @@ public class CreateQueueMessage extends PacketImpl {
|
|||
|
||||
protected boolean requiresResponse;
|
||||
|
||||
public CreateQueueMessage(final QueueConfiguration queueConfiguration, boolean requiresResponse) {
|
||||
this(queueConfiguration.getAddress(), queueConfiguration.getName(), queueConfiguration.getFilterString(), queueConfiguration.isDurable(), queueConfiguration.isTemporary(), requiresResponse);
|
||||
}
|
||||
|
||||
public CreateQueueMessage(final SimpleString address,
|
||||
final SimpleString queueName,
|
||||
final SimpleString filterString,
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.activemq.artemis.core.protocol.core.impl.wireformat;
|
|||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
|
||||
import org.apache.activemq.artemis.api.core.QueueAttributes;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.utils.BufferHelper;
|
||||
|
@ -58,6 +59,7 @@ public class CreateQueueMessage_V2 extends CreateQueueMessage {
|
|||
|
||||
private Long ringSize;
|
||||
|
||||
@Deprecated
|
||||
public CreateQueueMessage_V2(final SimpleString address,
|
||||
final SimpleString queueName,
|
||||
final boolean temporary,
|
||||
|
@ -91,6 +93,35 @@ public class CreateQueueMessage_V2 extends CreateQueueMessage {
|
|||
);
|
||||
}
|
||||
|
||||
public CreateQueueMessage_V2(final QueueConfiguration queueConfiguration,
|
||||
final boolean requiresResponse) {
|
||||
this(
|
||||
queueConfiguration.getAddress(),
|
||||
queueConfiguration.getName(),
|
||||
queueConfiguration.getRoutingType(),
|
||||
queueConfiguration.getFilterString(),
|
||||
queueConfiguration.isDurable(),
|
||||
queueConfiguration.isTemporary(),
|
||||
queueConfiguration.getMaxConsumers(),
|
||||
queueConfiguration.isPurgeOnNoConsumers(),
|
||||
queueConfiguration.isAutoCreated(),
|
||||
requiresResponse,
|
||||
queueConfiguration.isExclusive(),
|
||||
queueConfiguration.isGroupRebalance(),
|
||||
queueConfiguration.getGroupBuckets(),
|
||||
queueConfiguration.getGroupFirstKey(),
|
||||
queueConfiguration.isLastValue(),
|
||||
queueConfiguration.getLastValueKey(),
|
||||
queueConfiguration.isNonDestructive(),
|
||||
queueConfiguration.getConsumersBeforeDispatch(),
|
||||
queueConfiguration.getDelayBeforeDispatch(),
|
||||
queueConfiguration.isAutoDelete(),
|
||||
queueConfiguration.getAutoDeleteDelay(),
|
||||
queueConfiguration.getAutoDeleteMessageCount(),
|
||||
queueConfiguration.getRingSize()
|
||||
);
|
||||
}
|
||||
|
||||
public CreateQueueMessage_V2(final SimpleString address,
|
||||
final SimpleString queueName,
|
||||
final RoutingType routingType,
|
||||
|
@ -147,6 +178,31 @@ public class CreateQueueMessage_V2 extends CreateQueueMessage {
|
|||
|
||||
// Public --------------------------------------------------------
|
||||
|
||||
public QueueConfiguration toQueueConfiguration() {
|
||||
return new QueueConfiguration(queueName)
|
||||
.setAddress(address)
|
||||
.setDurable(durable)
|
||||
.setRoutingType(routingType)
|
||||
.setExclusive(exclusive)
|
||||
.setGroupRebalance(groupRebalance)
|
||||
.setNonDestructive(nonDestructive)
|
||||
.setLastValue(lastValue)
|
||||
.setFilterString(filterString)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setConsumersBeforeDispatch(consumersBeforeDispatch)
|
||||
.setDelayBeforeDispatch(delayBeforeDispatch)
|
||||
.setGroupBuckets(groupBuckets)
|
||||
.setGroupFirstKey(groupFirstKey)
|
||||
.setLastValueKey(lastValueKey)
|
||||
.setAutoDelete(autoDelete)
|
||||
.setAutoDeleteDelay(autoDeleteDelay)
|
||||
.setAutoDeleteMessageCount(autoDeleteMessageCount)
|
||||
.setTemporary(temporary)
|
||||
.setAutoCreated(autoCreated)
|
||||
.setRingSize(ringSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buff = new StringBuffer(super.getParentString());
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.activemq.artemis.core.protocol.core.impl.wireformat;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.utils.BufferHelper;
|
||||
|
@ -39,6 +40,31 @@ public class CreateSharedQueueMessage_V2 extends CreateSharedQueueMessage {
|
|||
private Long autoDeleteDelay;
|
||||
private Long autoDeleteMessageCount;
|
||||
|
||||
public CreateSharedQueueMessage_V2(final QueueConfiguration queueConfiguration, boolean requiresResponse) {
|
||||
this(
|
||||
queueConfiguration.getAddress(),
|
||||
queueConfiguration.getName(),
|
||||
queueConfiguration.getRoutingType(),
|
||||
queueConfiguration.getFilterString(),
|
||||
queueConfiguration.isDurable(),
|
||||
queueConfiguration.getMaxConsumers(),
|
||||
queueConfiguration.isPurgeOnNoConsumers(),
|
||||
queueConfiguration.isExclusive(),
|
||||
queueConfiguration.isGroupRebalance(),
|
||||
queueConfiguration.getGroupBuckets(),
|
||||
queueConfiguration.getGroupFirstKey(),
|
||||
queueConfiguration.isLastValue(),
|
||||
queueConfiguration.getLastValueKey(),
|
||||
queueConfiguration.isNonDestructive(),
|
||||
queueConfiguration.getConsumersBeforeDispatch(),
|
||||
queueConfiguration.getDelayBeforeDispatch(),
|
||||
queueConfiguration.isAutoDelete(),
|
||||
queueConfiguration.getAutoDeleteDelay(),
|
||||
queueConfiguration.getAutoDeleteMessageCount(),
|
||||
requiresResponse
|
||||
);
|
||||
}
|
||||
|
||||
public CreateSharedQueueMessage_V2(final SimpleString address,
|
||||
final SimpleString queueName,
|
||||
final RoutingType routingType,
|
||||
|
@ -207,6 +233,28 @@ public class CreateSharedQueueMessage_V2 extends CreateSharedQueueMessage {
|
|||
this.autoDeleteMessageCount = autoDeleteMessageCount;
|
||||
}
|
||||
|
||||
public QueueConfiguration toQueueConfiguration() {
|
||||
return new QueueConfiguration(queueName)
|
||||
.setAddress(address)
|
||||
.setDurable(durable)
|
||||
.setRoutingType(routingType)
|
||||
.setExclusive(exclusive)
|
||||
.setGroupRebalance(groupRebalance)
|
||||
.setNonDestructive(nonDestructive)
|
||||
.setLastValue(lastValue)
|
||||
.setFilterString(filterString)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setConsumersBeforeDispatch(consumersBeforeDispatch)
|
||||
.setDelayBeforeDispatch(delayBeforeDispatch)
|
||||
.setGroupBuckets(groupBuckets)
|
||||
.setGroupFirstKey(groupFirstKey)
|
||||
.setLastValueKey(lastValueKey)
|
||||
.setAutoDelete(autoDelete)
|
||||
.setAutoDeleteDelay(autoDeleteDelay)
|
||||
.setAutoDeleteMessageCount(autoDeleteMessageCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buff = new StringBuffer(getParentString());
|
||||
|
@ -240,7 +288,7 @@ public class CreateSharedQueueMessage_V2 extends CreateSharedQueueMessage {
|
|||
buffer.writeSimpleString(queueName);
|
||||
buffer.writeNullableSimpleString(filterString);
|
||||
buffer.writeBoolean(durable);
|
||||
buffer.writeByte(routingType.getType());
|
||||
buffer.writeByte(routingType == null ? -1 : routingType.getType());
|
||||
buffer.writeBoolean(requiresResponse);
|
||||
BufferHelper.writeNullableInteger(buffer, maxConsumers);
|
||||
BufferHelper.writeNullableBoolean(buffer, purgeOnNoConsumers);
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException;
|
|||
import org.apache.activemq.artemis.api.core.ICoreMessage;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueAttributes;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
|
@ -179,6 +180,7 @@ public abstract class SessionContext {
|
|||
* @param lastValue
|
||||
* @throws ActiveMQException
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void createSharedQueue(SimpleString address,
|
||||
SimpleString queueName,
|
||||
RoutingType routingType,
|
||||
|
@ -198,21 +200,26 @@ public abstract class SessionContext {
|
|||
* @param queueAttributes
|
||||
* @throws ActiveMQException
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void createSharedQueue(SimpleString address,
|
||||
SimpleString queueName,
|
||||
QueueAttributes queueAttributes) throws ActiveMQException;
|
||||
|
||||
@Deprecated
|
||||
public abstract void createSharedQueue(SimpleString address,
|
||||
SimpleString queueName,
|
||||
RoutingType routingType,
|
||||
SimpleString filterString,
|
||||
boolean durable) throws ActiveMQException;
|
||||
|
||||
@Deprecated
|
||||
public abstract void createSharedQueue(SimpleString address,
|
||||
SimpleString queueName,
|
||||
SimpleString filterString,
|
||||
boolean durable) throws ActiveMQException;
|
||||
|
||||
public abstract void createSharedQueue(QueueConfiguration queueConfiguration) throws ActiveMQException;
|
||||
|
||||
public abstract void deleteQueue(SimpleString queueName) throws ActiveMQException;
|
||||
|
||||
@Deprecated
|
||||
|
@ -257,6 +264,8 @@ public abstract class SessionContext {
|
|||
boolean autoCreated,
|
||||
QueueAttributes queueAttributes) throws ActiveMQException;
|
||||
|
||||
public abstract void createQueue(QueueConfiguration queueConfiguration) throws ActiveMQException;
|
||||
|
||||
public abstract ClientSession.QueueQuery queueQuery(SimpleString queueName) throws ActiveMQException;
|
||||
|
||||
public abstract void forceDelivery(ClientConsumer consumer, long sequence) throws ActiveMQException;
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.UUID;
|
|||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.ParameterisedAddress;
|
||||
import org.apache.activemq.artemis.api.core.QueueAttributes;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl;
|
||||
|
@ -331,10 +332,7 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se
|
|||
*/
|
||||
private SimpleString simpleAddress;
|
||||
|
||||
/**
|
||||
* Queue parameters;
|
||||
*/
|
||||
private QueueAttributes queueAttributes;
|
||||
private QueueConfiguration queueConfiguration;
|
||||
|
||||
/**
|
||||
* Needed for serialization backwards compatibility.
|
||||
|
@ -419,11 +417,11 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se
|
|||
ParameterisedAddress parameteredAddress = new ParameterisedAddress(address);
|
||||
this.simpleAddress = parameteredAddress.getAddress();
|
||||
this.address = parameteredAddress.getAddress().toString();
|
||||
this.queueAttributes = parameteredAddress.getQueueAttributes();
|
||||
this.queueConfiguration = parameteredAddress.getQueueConfiguration();
|
||||
} else {
|
||||
this.simpleAddress = address;
|
||||
this.address = address.toString();
|
||||
this.queueAttributes = null;
|
||||
this.queueConfiguration = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,8 +471,13 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se
|
|||
return simpleAddress;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public QueueAttributes getQueueAttributes() {
|
||||
return queueAttributes;
|
||||
return QueueAttributes.fromQueueConfiguration(queueConfiguration);
|
||||
}
|
||||
|
||||
public QueueConfiguration getQueueConfiguration() {
|
||||
return queueConfiguration;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
|
||||
import org.apache.activemq.artemis.api.core.QueueAttributes;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientProducer;
|
||||
|
@ -995,7 +996,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
|
|||
|
||||
SimpleString simpleAddress = queue.getSimpleAddress();
|
||||
|
||||
session.createTemporaryQueue(simpleAddress, RoutingType.ANYCAST, simpleAddress);
|
||||
session.createQueue(new QueueConfiguration(simpleAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false).setTemporary(true));
|
||||
|
||||
connection.addTemporaryQueue(simpleAddress);
|
||||
|
||||
|
@ -1029,7 +1030,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
|
|||
// does not exist - otherwise we would not be able to distinguish from a non existent topic and one with no
|
||||
// subscriptions - core has no notion of a topic
|
||||
|
||||
session.createTemporaryQueue(simpleAddress, simpleAddress, ActiveMQSession.REJECTING_FILTER);
|
||||
session.createQueue(new QueueConfiguration(simpleAddress).setAddress(simpleAddress).setFilterString(ActiveMQSession.REJECTING_FILTER).setDurable(false).setTemporary(true));
|
||||
|
||||
connection.addTemporaryQueue(simpleAddress);
|
||||
|
||||
|
@ -1253,32 +1254,21 @@ public class ActiveMQSession implements QueueSession, TopicSession {
|
|||
}
|
||||
|
||||
void createTemporaryQueue(ActiveMQDestination destination, RoutingType routingType, SimpleString queueName, SimpleString filter, ClientSession.AddressQuery addressQuery) throws ActiveMQException {
|
||||
QueueAttributes queueAttributes = destination.getQueueAttributes() == null ? new QueueAttributes() : destination.getQueueAttributes();
|
||||
setRequiredQueueAttributesIfNotSet(queueAttributes, addressQuery, routingType, filter, false);
|
||||
session.createTemporaryQueue(
|
||||
destination.getSimpleAddress(),
|
||||
queueName,
|
||||
queueAttributes
|
||||
);
|
||||
QueueConfiguration queueConfiguration = destination.getQueueConfiguration() == null ? new QueueConfiguration(queueName) : destination.getQueueConfiguration();
|
||||
setRequiredQueueConfigurationIfNotSet(queueConfiguration, addressQuery, routingType, filter, false);
|
||||
session.createQueue(queueConfiguration.setName(queueName).setAddress(destination.getAddress()).setDurable(false).setTemporary(true));
|
||||
}
|
||||
|
||||
void createSharedQueue(ActiveMQDestination destination, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, ClientSession.AddressQuery addressQuery) throws ActiveMQException {
|
||||
QueueAttributes queueAttributes = destination.getQueueAttributes() == null ? new QueueAttributes() : destination.getQueueAttributes();
|
||||
setRequiredQueueAttributesIfNotSet(queueAttributes, addressQuery, routingType, filter, durable);
|
||||
session.createSharedQueue(
|
||||
destination.getSimpleAddress(),
|
||||
queueName,
|
||||
queueAttributes);
|
||||
QueueConfiguration queueConfiguration = destination.getQueueConfiguration() == null ? new QueueConfiguration(queueName) : destination.getQueueConfiguration();
|
||||
setRequiredQueueConfigurationIfNotSet(queueConfiguration, addressQuery, routingType, filter, durable);
|
||||
session.createSharedQueue(queueConfiguration.setName(queueName).setAddress(destination.getAddress()));
|
||||
}
|
||||
|
||||
void createQueue(ActiveMQDestination destination, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated, ClientSession.AddressQuery addressQuery) throws ActiveMQException {
|
||||
QueueAttributes queueAttributes = destination.getQueueAttributes() == null ? new QueueAttributes() : destination.getQueueAttributes();
|
||||
setRequiredQueueAttributesIfNotSet(queueAttributes, addressQuery, routingType, filter, durable);
|
||||
session.createQueue(
|
||||
destination.getSimpleAddress(),
|
||||
queueName,
|
||||
autoCreated,
|
||||
queueAttributes);
|
||||
QueueConfiguration queueConfiguration = destination.getQueueConfiguration() == null ? new QueueConfiguration(queueName) : destination.getQueueConfiguration();
|
||||
setRequiredQueueConfigurationIfNotSet(queueConfiguration, addressQuery, routingType, filter, durable);
|
||||
session.createQueue(queueConfiguration.setName(queueName).setAddress(destination.getAddress()).setAutoCreated(autoCreated));
|
||||
}
|
||||
|
||||
// Private -------------------------------------------------------
|
||||
|
@ -1340,29 +1330,26 @@ public class ActiveMQSession implements QueueSession, TopicSession {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the non nullable (CreateQueueMessage_V2) queue attributes (all others get defaulted if null by address settings server side).
|
||||
* Set the non nullable (CreateQueueMessage_V2) queue attributes (all others have static defaults or get defaulted if null by address settings server side).
|
||||
*
|
||||
* @param queueAttributes the provided queue attributes the client wants to set
|
||||
* @param queueConfiguration the provided queue configuration the client wants to set
|
||||
* @param addressQuery the address settings query information (this could be removed if max consumers and purge on no consumers were null-able in CreateQueueMessage_V2)
|
||||
* @param routingType of the queue (multicast or anycast)
|
||||
* @param filter to apply on the queue
|
||||
* @param durable if queue is durable
|
||||
*/
|
||||
private void setRequiredQueueAttributesIfNotSet(QueueAttributes queueAttributes, ClientSession.AddressQuery addressQuery, RoutingType routingType, SimpleString filter, boolean durable) {
|
||||
if (queueAttributes.getRoutingType() == null) {
|
||||
queueAttributes.setRoutingType(routingType);
|
||||
private void setRequiredQueueConfigurationIfNotSet(QueueConfiguration queueConfiguration, ClientSession.AddressQuery addressQuery, RoutingType routingType, SimpleString filter, boolean durable) {
|
||||
if (queueConfiguration.getRoutingType() == null) {
|
||||
queueConfiguration.setRoutingType(routingType);
|
||||
}
|
||||
if (queueAttributes.getFilterString() == null) {
|
||||
queueAttributes.setFilterString(filter);
|
||||
if (queueConfiguration.getFilterString() == null) {
|
||||
queueConfiguration.setFilterString(filter);
|
||||
}
|
||||
if (queueAttributes.getDurable() == null) {
|
||||
queueAttributes.setDurable(durable);
|
||||
if (queueConfiguration.getMaxConsumers() == null) {
|
||||
queueConfiguration.setMaxConsumers(addressQuery.getDefaultMaxConsumers());
|
||||
}
|
||||
if (queueAttributes.getMaxConsumers() == null) {
|
||||
queueAttributes.setMaxConsumers(addressQuery.getDefaultMaxConsumers());
|
||||
}
|
||||
if (queueAttributes.getPurgeOnNoConsumers() == null) {
|
||||
queueAttributes.setPurgeOnNoConsumers(addressQuery.isDefaultPurgeOnNoConsumers());
|
||||
if (queueConfiguration.isPurgeOnNoConsumers() == null) {
|
||||
queueConfiguration.setPurgeOnNoConsumers(addressQuery.isDefaultPurgeOnNoConsumers());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,18 +31,18 @@ public class ActiveMQParameterTest {
|
|||
@Test
|
||||
public void testQueueParameters() {
|
||||
ActiveMQDestination activeMQDestination = new ActiveMQQueue("jms.queue.foo?exclusive=true");
|
||||
assertTrue(activeMQDestination.getQueueAttributes().getExclusive());
|
||||
assertTrue(activeMQDestination.getQueueConfiguration().isExclusive());
|
||||
|
||||
assertEquals("jms.queue.foo", activeMQDestination.getAddress());
|
||||
|
||||
activeMQDestination = new ActiveMQQueue("jms.queue.foo?exclusive=false");
|
||||
assertFalse(activeMQDestination.getQueueAttributes().getExclusive());
|
||||
assertFalse(activeMQDestination.getQueueConfiguration().isExclusive());
|
||||
|
||||
activeMQDestination = new ActiveMQQueue("jms.queue.foo?last-value=true");
|
||||
assertTrue(activeMQDestination.getQueueAttributes().getLastValue());
|
||||
assertTrue(activeMQDestination.getQueueConfiguration().isLastValue());
|
||||
|
||||
activeMQDestination = new ActiveMQQueue("jms.queue.foo?last-value=false");
|
||||
assertFalse(activeMQDestination.getQueueAttributes().getLastValue());
|
||||
assertFalse(activeMQDestination.getQueueConfiguration().isLastValue());
|
||||
|
||||
}
|
||||
|
||||
|
@ -50,14 +50,14 @@ public class ActiveMQParameterTest {
|
|||
public void testMultipleQueueParameters() {
|
||||
ActiveMQDestination activeMQDestination = new ActiveMQQueue("jms.queue.foo?last-value=true&exclusive=true");
|
||||
assertEquals("jms.queue.foo", activeMQDestination.getAddress());
|
||||
assertTrue(activeMQDestination.getQueueAttributes().getLastValue());
|
||||
assertTrue(activeMQDestination.getQueueAttributes().getExclusive());
|
||||
assertTrue(activeMQDestination.getQueueConfiguration().isLastValue());
|
||||
assertTrue(activeMQDestination.getQueueConfiguration().isExclusive());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoQueueParameters() {
|
||||
ActiveMQDestination activeMQDestination = new ActiveMQQueue("jms.queue.foo");
|
||||
assertEquals("jms.queue.foo", activeMQDestination.getAddress());
|
||||
assertNull(activeMQDestination.getQueueAttributes());
|
||||
assertNull(activeMQDestination.getQueueConfiguration());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
|
@ -1079,8 +1080,7 @@ public class JMSServerManagerImpl extends CleaningActivateCallback implements JM
|
|||
|
||||
server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString(queueName)).addRoutingType(RoutingType.ANYCAST));
|
||||
|
||||
AddressSettings as = server.getAddressSettingsRepository().getMatch(queueName);
|
||||
server.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(coreFilterString), null, durable, false, true, false, false, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), as.isAutoCreateAddresses());
|
||||
server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setFilterString(coreFilterString).setDurable(durable), true);
|
||||
|
||||
// create the JMS queue with the logical name jmsQueueName and keeps queueName for its *core* queue name
|
||||
queues.put(queueName, ActiveMQDestination.createQueue(queueName, jmsQueueName));
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.activemq.artemis.junit;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientMessage;
|
||||
|
@ -103,7 +104,7 @@ public class ActiveMQConsumerResource extends AbstractActiveMQClientResource {
|
|||
if (!session.queueQuery(queueName).isExists() && autoCreateQueue) {
|
||||
log.warn("{}: queue does not exist - creating queue: address = {}, name = {}", this.getClass().getSimpleName(), queueName.toString(), queueName.toString());
|
||||
session.createAddress(queueName, RoutingType.MULTICAST, true);
|
||||
session.createQueue(queueName, queueName);
|
||||
session.createQueue(new QueueConfiguration(queueName));
|
||||
}
|
||||
consumer = session.createConsumer(queueName, browseOnly);
|
||||
} catch (ActiveMQException amqEx) {
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.activemq.artemis.junit;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientMessage;
|
||||
import org.apache.activemq.artemis.api.core.client.ServerLocator;
|
||||
|
@ -81,7 +82,7 @@ public class ActiveMQDynamicProducerResource extends ActiveMQProducerResource {
|
|||
try {
|
||||
if (address != null && !session.addressQuery(address).isExists() && autoCreateQueue) {
|
||||
log.warn("queue does not exist - creating queue: address = {}, name = {}", address.toString(), address.toString());
|
||||
session.createQueue(address, address);
|
||||
session.createQueue(new QueueConfiguration(address));
|
||||
}
|
||||
producer = session.createProducer((SimpleString) null);
|
||||
} catch (ActiveMQException amqEx) {
|
||||
|
@ -116,7 +117,7 @@ public class ActiveMQDynamicProducerResource extends ActiveMQProducerResource {
|
|||
try {
|
||||
if (autoCreateQueue && !session.addressQuery(targetAddress).isExists()) {
|
||||
log.warn("queue does not exist - creating queue: address = {}, name = {}", address.toString(), address.toString());
|
||||
session.createQueue(targetAddress, targetAddress);
|
||||
session.createQueue(new QueueConfiguration(targetAddress));
|
||||
}
|
||||
} catch (ActiveMQException amqEx) {
|
||||
throw new ActiveMQClientResourceException(String.format("Queue creation failed for queue: address = %s, name = %s", address.toString(), address.toString()));
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.activemq.artemis.junit;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientMessage;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientProducer;
|
||||
|
@ -123,7 +124,7 @@ public class ActiveMQProducerResource extends AbstractActiveMQClientResource {
|
|||
try {
|
||||
if (!session.addressQuery(address).isExists() && autoCreateQueue) {
|
||||
log.warn("{}: queue does not exist - creating queue: address = {}, name = {}", this.getClass().getSimpleName(), address.toString(), address.toString());
|
||||
session.createQueue(address, address);
|
||||
session.createQueue(new QueueConfiguration(address));
|
||||
}
|
||||
producer = session.createProducer(address);
|
||||
} catch (ActiveMQException amqEx) {
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
|
||||
|
@ -358,11 +359,9 @@ public class EmbeddedActiveMQResource extends ExternalResource {
|
|||
}
|
||||
|
||||
public Queue createQueue(SimpleString address, SimpleString name) {
|
||||
SimpleString filter = null;
|
||||
boolean temporary = false;
|
||||
Queue queue = null;
|
||||
try {
|
||||
queue = server.getActiveMQServer().createQueue(address, RoutingType.MULTICAST, name, filter, isUseDurableQueue(), temporary, server.getActiveMQServer().getAddressSettingsRepository().getMatch(address.toString()).getDefaultMaxConsumers(), server.getActiveMQServer().getAddressSettingsRepository().getMatch(address.toString()).isDefaultPurgeOnNoConsumers(), true);
|
||||
queue = server.getActiveMQServer().createQueue(new QueueConfiguration(name).setAddress(address).setDurable(isUseDurableQueue()));
|
||||
} catch (Exception ex) {
|
||||
throw new EmbeddedActiveMQResourceException(String.format("Failed to create queue: queueName = %s, name = %s", address.toString(), name.toString()), ex);
|
||||
}
|
||||
|
@ -379,9 +378,8 @@ public class EmbeddedActiveMQResource extends ExternalResource {
|
|||
}
|
||||
|
||||
public void createSharedQueue(SimpleString address, SimpleString name, SimpleString user) {
|
||||
SimpleString filter = null;
|
||||
try {
|
||||
server.getActiveMQServer().createSharedQueue(address, RoutingType.MULTICAST, name, filter, user, isUseDurableQueue());
|
||||
server.getActiveMQServer().createSharedQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.MULTICAST).setDurable(isUseDurableQueue()).setUser(user));
|
||||
} catch (Exception ex) {
|
||||
throw new EmbeddedActiveMQResourceException(String.format("Failed to create shared queue: queueName = %s, name = %s, user = %s", address.toString(), name.toString(), user.toString()), ex);
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ package org.apache.activemq.artemis.junit;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.Configuration;
|
||||
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
|
||||
import org.apache.activemq.artemis.core.server.Queue;
|
||||
import org.junit.After;
|
||||
|
@ -37,7 +37,7 @@ public class EmbeddedActiveMQResourceCustomConfigurationTest {
|
|||
static final String TEST_QUEUE = "test.queue";
|
||||
static final String TEST_ADDRESS = "test.address";
|
||||
|
||||
CoreQueueConfiguration queueConfiguration = new CoreQueueConfiguration().setAddress(TEST_ADDRESS).setName(TEST_QUEUE);
|
||||
QueueConfiguration queueConfiguration = new QueueConfiguration(TEST_QUEUE).setAddress(TEST_ADDRESS);
|
||||
Configuration customConfiguration = new ConfigurationImpl().setPersistenceEnabled(false).setSecurityEnabled(true).addQueueConfiguration(queueConfiguration);
|
||||
|
||||
private EmbeddedActiveMQResource server = new EmbeddedActiveMQResource(customConfiguration);
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQSecurityException;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
|
||||
|
@ -252,7 +253,7 @@ public class AMQPSessionCallback implements SessionCallback {
|
|||
RoutingType routingType,
|
||||
SimpleString filter) throws Exception {
|
||||
try {
|
||||
serverSession.createQueue(address, queueName, routingType, filter, true, false);
|
||||
serverSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(routingType).setFilterString(filter).setTemporary(true).setDurable(false));
|
||||
} catch (ActiveMQSecurityException se) {
|
||||
throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingTempDestination(se.getMessage());
|
||||
}
|
||||
|
@ -263,7 +264,7 @@ public class AMQPSessionCallback implements SessionCallback {
|
|||
SimpleString queueName,
|
||||
SimpleString filter) throws Exception {
|
||||
try {
|
||||
serverSession.createQueue(address, queueName, routingType, filter, false, true, 1, false, false);
|
||||
serverSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(routingType).setFilterString(filter).setMaxConsumers(1));
|
||||
} catch (ActiveMQSecurityException se) {
|
||||
throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingConsumer(se.getMessage());
|
||||
}
|
||||
|
@ -274,7 +275,7 @@ public class AMQPSessionCallback implements SessionCallback {
|
|||
SimpleString queueName,
|
||||
SimpleString filter) throws Exception {
|
||||
try {
|
||||
serverSession.createSharedQueue(address, queueName, routingType, filter, true, -1, false, false, false);
|
||||
serverSession.createSharedQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(routingType).setFilterString(filter));
|
||||
} catch (ActiveMQQueueExistsException alreadyExists) {
|
||||
// nothing to be done.. just ignore it. if you have many consumers all doing the same another one probably already done it
|
||||
} catch (ActiveMQSecurityException se) {
|
||||
|
@ -287,7 +288,7 @@ public class AMQPSessionCallback implements SessionCallback {
|
|||
SimpleString queueName,
|
||||
SimpleString filter) throws Exception {
|
||||
try {
|
||||
serverSession.createSharedQueue(address, queueName, routingType, filter, false, -1, false, false, false);
|
||||
serverSession.createSharedQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(routingType).setFilterString(filter).setDurable(false));
|
||||
} catch (ActiveMQSecurityException se) {
|
||||
throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingConsumer(se.getMessage());
|
||||
} catch (ActiveMQQueueExistsException e) {
|
||||
|
@ -300,7 +301,7 @@ public class AMQPSessionCallback implements SessionCallback {
|
|||
|
||||
if (!queueQueryResult.isExists() && queueQueryResult.isAutoCreateQueues() && autoCreate) {
|
||||
try {
|
||||
serverSession.createQueue(queueName, queueName, routingType, null, false, true, true);
|
||||
serverSession.createQueue(new QueueConfiguration(queueName).setRoutingType(routingType).setAutoCreated(true));
|
||||
} catch (ActiveMQQueueExistsException e) {
|
||||
// The queue may have been created by another thread in the mean time. Catch and do nothing.
|
||||
}
|
||||
|
@ -342,7 +343,7 @@ public class AMQPSessionCallback implements SessionCallback {
|
|||
if (manager.getServer().locateQueue(unPrefixedAddress) == null) {
|
||||
if (addressSettings.isAutoCreateQueues()) {
|
||||
try {
|
||||
serverSession.createQueue(address, address, routingType, null, false, true, true);
|
||||
serverSession.createQueue(new QueueConfiguration(address).setRoutingType(routingType).setAutoCreated(true));
|
||||
} catch (ActiveMQQueueExistsException e) {
|
||||
// The queue may have been created by another thread in the mean time. Catch and do nothing.
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException;
|
|||
import org.apache.activemq.artemis.api.core.ICoreMessage;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.io.IOCallback;
|
||||
|
@ -101,7 +102,9 @@ public class MQTTPublishManager {
|
|||
private void createManagementQueue() throws Exception {
|
||||
Queue q = session.getServer().locateQueue(managementAddress);
|
||||
if (q == null) {
|
||||
session.getServer().createQueue(managementAddress, RoutingType.ANYCAST, managementAddress, null, MQTTUtil.DURABLE_MESSAGES, false);
|
||||
session.getServer().createQueue(new QueueConfiguration(managementAddress)
|
||||
.setRoutingType(RoutingType.ANYCAST)
|
||||
.setDurable(MQTTUtil.DURABLE_MESSAGES));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package org.apache.activemq.artemis.core.protocol.mqtt;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.server.BindingQueryResult;
|
||||
import org.apache.activemq.artemis.core.server.MessageReference;
|
||||
|
@ -49,7 +50,7 @@ public class MQTTRetainMessageManager {
|
|||
|
||||
Queue queue = session.getServer().locateQueue(retainAddress);
|
||||
if (queue == null) {
|
||||
queue = session.getServer().createQueue(retainAddress, retainAddress, null, true, false);
|
||||
queue = session.getServer().createQueue(new QueueConfiguration(retainAddress));
|
||||
}
|
||||
|
||||
queue.deleteAllReferences();
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.concurrent.ConcurrentMap;
|
|||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
|
||||
import org.apache.activemq.artemis.api.core.FilterConstants;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
|
||||
|
@ -121,7 +122,7 @@ public class MQTTSubscriptionManager {
|
|||
private Queue findOrCreateQueue(BindingQueryResult bindingQueryResult, AddressInfo addressInfo, SimpleString queue, int qos) throws Exception {
|
||||
|
||||
if (addressInfo.getRoutingTypes().contains(RoutingType.MULTICAST)) {
|
||||
return session.getServerSession().createQueue(addressInfo.getName(), queue, RoutingType.MULTICAST, managementFilter, false, MQTTUtil.DURABLE_MESSAGES && qos >= 0, false);
|
||||
return session.getServerSession().createQueue(new QueueConfiguration(queue).setAddress(addressInfo.getName()).setFilterString(managementFilter).setDurable(MQTTUtil.DURABLE_MESSAGES && qos >= 0));
|
||||
}
|
||||
|
||||
if (addressInfo.getRoutingTypes().contains(RoutingType.ANYCAST)) {
|
||||
|
@ -137,7 +138,7 @@ public class MQTTSubscriptionManager {
|
|||
return session.getServer().locateQueue(name);
|
||||
} else {
|
||||
try {
|
||||
return session.getServerSession().createQueue(addressInfo.getName(), addressInfo.getName(), RoutingType.ANYCAST, managementFilter, false, MQTTUtil.DURABLE_MESSAGES && qos >= 0, false);
|
||||
return session.getServerSession().createQueue(new QueueConfiguration(addressInfo.getName()).setRoutingType(RoutingType.ANYCAST).setFilterString(managementFilter).setDurable(MQTTUtil.DURABLE_MESSAGES && qos >= 0));
|
||||
} catch (ActiveMQQueueExistsException e) {
|
||||
return session.getServer().locateQueue(addressInfo.getName());
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQRemoteDisconnectException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQSecurityException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.client.ActiveMQClientLogger;
|
||||
|
@ -817,19 +818,19 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
|
|||
SimpleString qName = SimpleString.toSimpleString(dest.getPhysicalName());
|
||||
if (server.locateQueue(qName) == null) {
|
||||
AddressSettings addressSettings = server.getAddressSettingsRepository().getMatch(dest.getPhysicalName());
|
||||
AddressInfo addressInfo = new AddressInfo(qName, dest.isTopic() ? RoutingType.MULTICAST : RoutingType.ANYCAST);
|
||||
if (AdvisorySupport.isAdvisoryTopic(dest) && protocolManager.isSuppressInternalManagementObjects()) {
|
||||
addressInfo.setInternal(true);
|
||||
}
|
||||
if (dest.isQueue() && (addressSettings.isAutoCreateQueues() || dest.isTemporary())) {
|
||||
try {
|
||||
internalSession.createQueue(addressInfo, qName, null, dest.isTemporary(), !dest.isTemporary(), !dest.isTemporary());
|
||||
internalSession.createQueue(new QueueConfiguration(qName).setRoutingType(RoutingType.ANYCAST).setDurable(!dest.isTemporary()).setTemporary(dest.isTemporary()).setAutoCreated(!dest.isTemporary()));
|
||||
created = true;
|
||||
} catch (ActiveMQQueueExistsException exists) {
|
||||
// The queue may have been created by another thread in the mean time. Catch and do nothing.
|
||||
}
|
||||
} else if (dest.isTopic() && (addressSettings.isAutoCreateAddresses() || dest.isTemporary())) {
|
||||
try {
|
||||
AddressInfo addressInfo = new AddressInfo(qName, RoutingType.MULTICAST);
|
||||
if (AdvisorySupport.isAdvisoryTopic(dest) && protocolManager.isSuppressInternalManagementObjects()) {
|
||||
addressInfo.setInternal(true);
|
||||
}
|
||||
if (internalSession.getAddress(addressInfo.getName()) == null) {
|
||||
internalSession.createAddress(addressInfo, !dest.isTemporary());
|
||||
created = true;
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.apache.activemq.advisory.AdvisorySupport;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
|
||||
import org.apache.activemq.artemis.api.core.ICoreMessage;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl;
|
||||
|
@ -42,7 +43,6 @@ import org.apache.activemq.artemis.core.server.MessageReference;
|
|||
import org.apache.activemq.artemis.core.server.QueueQueryResult;
|
||||
import org.apache.activemq.artemis.core.server.ServerConsumer;
|
||||
import org.apache.activemq.artemis.core.server.SlowConsumerDetectionListener;
|
||||
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
|
||||
import org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl;
|
||||
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
|
||||
import org.apache.activemq.artemis.core.transaction.Transaction;
|
||||
|
@ -149,7 +149,8 @@ public class AMQConsumer {
|
|||
((ServerConsumerImpl)serverConsumer).setPreAcknowledge(preAck);
|
||||
} else {
|
||||
try {
|
||||
session.getCoreServer().createQueue(destinationName, RoutingType.ANYCAST, destinationName, null, true, false);
|
||||
session.getCoreServer().createQueue(new QueueConfiguration(destinationName)
|
||||
.setRoutingType(RoutingType.ANYCAST));
|
||||
} catch (ActiveMQQueueExistsException e) {
|
||||
// ignore
|
||||
}
|
||||
|
@ -180,13 +181,6 @@ public class AMQConsumer {
|
|||
|
||||
SimpleString queueName;
|
||||
|
||||
AddressInfo addressInfo = session.getCoreServer().getAddressInfo(address);
|
||||
if (addressInfo != null) {
|
||||
addressInfo.addRoutingType(RoutingType.MULTICAST);
|
||||
} else {
|
||||
addressInfo = new AddressInfo(address, RoutingType.MULTICAST);
|
||||
}
|
||||
addressInfo.setInternal(internalAddress);
|
||||
if (isDurable) {
|
||||
queueName = org.apache.activemq.artemis.jms.client.ActiveMQDestination.createQueueNameForSubscription(true, clientID, subscriptionName);
|
||||
if (info.getDestination().isComposite()) {
|
||||
|
@ -212,15 +206,15 @@ public class AMQConsumer {
|
|||
session.getCoreSession().deleteQueue(queueName);
|
||||
|
||||
// Create the new one
|
||||
session.getCoreSession().createQueue(addressInfo, queueName, selector, false, true);
|
||||
session.getCoreSession().createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(selector).setInternal(internalAddress));
|
||||
}
|
||||
} else {
|
||||
session.getCoreSession().createQueue(addressInfo, queueName, selector, false, true);
|
||||
session.getCoreSession().createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(selector).setInternal(internalAddress));
|
||||
}
|
||||
} else {
|
||||
queueName = new SimpleString(UUID.randomUUID().toString());
|
||||
|
||||
session.getCoreSession().createQueue(addressInfo, queueName, selector, true, false);
|
||||
session.getCoreSession().createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(selector).setDurable(false).setTemporary(true).setInternal(internalAddress));
|
||||
}
|
||||
|
||||
return queueName;
|
||||
|
|
|
@ -29,6 +29,7 @@ import javax.jms.ResourceAllocationException;
|
|||
|
||||
import org.apache.activemq.advisory.AdvisorySupport;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.io.IOCallback;
|
||||
|
@ -248,7 +249,7 @@ public class AMQSession implements SessionCallback {
|
|||
routingTypeToUse = as.getDefaultAddressRoutingType();
|
||||
}
|
||||
}
|
||||
coreSession.createQueue(addressToUse, queueNameToUse, routingTypeToUse, null, isTemporary, true, true);
|
||||
coreSession.createQueue(new QueueConfiguration(queueNameToUse).setAddress(addressToUse).setRoutingType(routingTypeToUse).setTemporary(isTemporary).setAutoCreated(true));
|
||||
connection.addKnownDestination(queueName);
|
||||
} else {
|
||||
hasQueue = false;
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQSecurityException;
|
||||
import org.apache.activemq.artemis.api.core.ICoreMessage;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
|
||||
|
@ -301,7 +302,7 @@ public final class StompConnection implements RemotingConnection {
|
|||
|
||||
// only auto create the queue if the address is ANYCAST
|
||||
if (effectiveAddressRoutingType == RoutingType.ANYCAST && addressSettings.isAutoCreateQueues() && manager.getServer().locateQueue(simpleQueue) == null) {
|
||||
session.createQueue(simpleQueue, simpleQueue, routingType == null ? addressSettings.getDefaultQueueRoutingType() : routingType, null, false, true, true);
|
||||
session.createQueue(new QueueConfiguration(simpleQueue).setRoutingType(effectiveAddressRoutingType).setAutoCreated(true));
|
||||
}
|
||||
} catch (ActiveMQQueueExistsException e) {
|
||||
// ignore
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
|
|||
import org.apache.activemq.artemis.api.core.ICoreMessage;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.message.impl.CoreMessage;
|
||||
|
@ -267,14 +268,14 @@ public class StompSession implements SessionCallback {
|
|||
queueName = SimpleString.toSimpleString(clientID + "." + durableSubscriptionName);
|
||||
if (manager.getServer().locateQueue(queueName) == null) {
|
||||
try {
|
||||
session.createQueue(address, queueName, selectorSimple, false, true);
|
||||
session.createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(selectorSimple));
|
||||
} catch (ActiveMQQueueExistsException e) {
|
||||
// ignore; can be caused by concurrent durable subscribers
|
||||
}
|
||||
}
|
||||
} else {
|
||||
queueName = UUIDGenerator.getInstance().generateSimpleStringUUID();
|
||||
session.createQueue(address, queueName, selectorSimple, true, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(selectorSimple).setDurable(false).setTemporary(true));
|
||||
}
|
||||
}
|
||||
final ServerConsumer consumer = session.createConsumer(consumerID, queueName, multicast ? null : selectorSimple, false, false, 0);
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.core.protocol.stomp;
|
||||
|
||||
import static org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompProtocolMessageBundle.BUNDLE;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
|
@ -31,9 +29,10 @@ import org.apache.activemq.artemis.core.protocol.stomp.Stomp.Headers;
|
|||
import org.apache.activemq.artemis.core.protocol.stomp.v10.StompFrameHandlerV10;
|
||||
import org.apache.activemq.artemis.core.protocol.stomp.v11.StompFrameHandlerV11;
|
||||
import org.apache.activemq.artemis.core.protocol.stomp.v12.StompFrameHandlerV12;
|
||||
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
|
||||
import org.apache.activemq.artemis.utils.ExecutorFactory;
|
||||
|
||||
import static org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompProtocolMessageBundle.BUNDLE;
|
||||
|
||||
public abstract class VersionedStompFrameHandler {
|
||||
|
||||
protected StompConnection connection;
|
||||
|
@ -372,7 +371,7 @@ public abstract class VersionedStompFrameHandler {
|
|||
if (typeHeader != null) {
|
||||
routingType = RoutingType.valueOf(typeHeader);
|
||||
} else {
|
||||
routingType = connection.getSession().getCoreSession().getAddressAndRoutingType(new AddressInfo(new SimpleString(destination))).getRoutingType();
|
||||
routingType = connection.getSession().getCoreSession().getRoutingTypeFromPrefix(new SimpleString(destination), null);
|
||||
}
|
||||
return routingType;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientMessage;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSession.QueueQuery;
|
||||
|
@ -123,7 +124,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
|
|||
QueueQuery subResponse = session.queueQuery(queueName);
|
||||
|
||||
if (!subResponse.isExists()) {
|
||||
session.createQueue(activation.getAddress(), queueName, selectorString, true);
|
||||
session.createQueue(new QueueConfiguration(queueName).setAddress(activation.getAddress()).setFilterString(selectorString));
|
||||
} else {
|
||||
// The check for already exists should be done only at the first session
|
||||
// As a deployed MDB could set up multiple instances in order to process messages in parallel.
|
||||
|
@ -148,7 +149,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
|
|||
session.deleteQueue(queueName);
|
||||
|
||||
// Create the new one
|
||||
session.createQueue(activation.getAddress(), queueName, selectorString, true);
|
||||
session.createQueue(new QueueConfiguration(queueName).setAddress(activation.getAddress()).setFilterString(selectorString));
|
||||
}
|
||||
}
|
||||
consumer = (ClientConsumerInternal) session.createConsumer(queueName, null, false);
|
||||
|
@ -157,7 +158,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
|
|||
if (activation.isTopic()) {
|
||||
if (activation.getTopicTemporaryQueue() == null) {
|
||||
tempQueueName = new SimpleString(UUID.randomUUID().toString());
|
||||
session.createTemporaryQueue(activation.getAddress(), tempQueueName, selectorString);
|
||||
session.createQueue(new QueueConfiguration(tempQueueName).setAddress(activation.getAddress()).setFilterString(selectorString).setDurable(false).setTemporary(true));
|
||||
activation.setTopicTemporaryQueue(tempQueueName);
|
||||
} else {
|
||||
tempQueueName = activation.getTopicTemporaryQueue();
|
||||
|
@ -165,7 +166,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
|
|||
if (!queueQuery.isExists()) {
|
||||
// this is because we could be using remote servers (in cluster maybe)
|
||||
// and the queue wasn't created on that node yet.
|
||||
session.createTemporaryQueue(activation.getAddress(), tempQueueName, selectorString);
|
||||
session.createQueue(new QueueConfiguration(tempQueueName).setAddress(activation.getAddress()).setFilterString(selectorString).setDurable(false).setTemporary(true));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.Map;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSession;
|
||||
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
|
||||
|
@ -67,9 +68,9 @@ public class QueueDestinationsResource {
|
|||
ClientSession.QueueQuery query = session.queueQuery(new SimpleString(queueName));
|
||||
if (!query.isExists()) {
|
||||
if (queue.getSelector() != null) {
|
||||
session.createQueue(queueName, queueName, queue.getSelector(), queue.isDurable());
|
||||
session.createQueue(new QueueConfiguration(queueName).setFilterString(queue.getSelector()).setDurable(queue.isDurable()));
|
||||
} else {
|
||||
session.createQueue(queueName, queueName, queue.isDurable());
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(queue.isDurable()));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.activemq.artemis.rest.queue;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSession;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
|
@ -86,11 +87,11 @@ public class QueueServiceManager extends DestinationServiceManager {
|
|||
ClientSession.AddressQuery query = session.addressQuery(SimpleString.toSimpleString(queueName));
|
||||
if (!query.isExists()) {
|
||||
session.createAddress(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, true);
|
||||
session.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), queueDeployment.isDurableSend());
|
||||
session.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setDurable(queueDeployment.isDurableSend()));
|
||||
} else {
|
||||
ClientSession.QueueQuery qquery = session.queueQuery(SimpleString.toSimpleString(queueName));
|
||||
if (!qquery.isExists()) {
|
||||
session.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), queueDeployment.isDurableSend());
|
||||
session.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setDurable(queueDeployment.isDurableSend()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSession;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
|
||||
|
@ -76,11 +77,7 @@ public class PushSubscriptionsResource {
|
|||
try {
|
||||
session = sessionFactory.createSession();
|
||||
|
||||
if (durable) {
|
||||
session.createQueue(destination, subscriptionName, true);
|
||||
} else {
|
||||
session.createTemporaryQueue(destination, subscriptionName);
|
||||
}
|
||||
session.createQueue(new QueueConfiguration(subscriptionName).setAddress(destination).setDurable(durable).setTemporary(!durable));
|
||||
return session;
|
||||
} catch (ActiveMQException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.util.concurrent.ConcurrentMap;
|
|||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSession;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
|
||||
|
@ -186,11 +187,7 @@ public class SubscriptionsResource implements TimeoutTask.Callback {
|
|||
if (!subscriptionExists(subscriptionName)) {
|
||||
session = sessionFactory.createSession();
|
||||
|
||||
if (durable) {
|
||||
session.createQueue(destination, subscriptionName, true);
|
||||
} else {
|
||||
session.createTemporaryQueue(destination, subscriptionName);
|
||||
}
|
||||
session.createQueue(new QueueConfiguration(subscriptionName).setAddress(destination).setDurable(durable).setTemporary(!durable));
|
||||
}
|
||||
QueueConsumer consumer = createConsumer(durable, autoAck, subscriptionName, selector, timeout, deleteWhenIdle);
|
||||
queueConsumers.put(consumer.getId(), consumer);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.rest.test;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
|
||||
|
@ -32,7 +33,7 @@ public class FindDestinationTest extends MessageTestBase {
|
|||
public void testFindQueue() throws Exception {
|
||||
String testName = "testFindQueue";
|
||||
server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(testName), RoutingType.MULTICAST));
|
||||
server.getActiveMQServer().createQueue(new SimpleString(testName), RoutingType.MULTICAST, new SimpleString(testName), null, false, false);
|
||||
server.getActiveMQServer().createQueue(new QueueConfiguration(testName).setDurable(false));
|
||||
|
||||
ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/queues/" + testName));
|
||||
|
||||
|
@ -63,7 +64,9 @@ public class FindDestinationTest extends MessageTestBase {
|
|||
@Test
|
||||
public void testFindTopic() throws Exception {
|
||||
server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString("testTopic"), RoutingType.MULTICAST));
|
||||
server.getActiveMQServer().createQueue(new SimpleString("testTopic"), RoutingType.MULTICAST, new SimpleString("testTopic"), null, false, false);
|
||||
server.getActiveMQServer().createQueue(new QueueConfiguration("testTopic")
|
||||
.setRoutingType(RoutingType.MULTICAST)
|
||||
.setDurable(false));
|
||||
ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/topics/testTopic"));
|
||||
|
||||
ClientResponse<?> response = request.head();
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.activemq.artemis.rest.test;
|
|||
import java.util.HashMap;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
|
@ -68,7 +69,7 @@ public class RawAckTest {
|
|||
|
||||
SimpleString addr = SimpleString.toSimpleString("testQueue");
|
||||
activeMQServer.addAddressInfo(new AddressInfo(addr, RoutingType.MULTICAST));
|
||||
activeMQServer.createQueue(addr, RoutingType.MULTICAST, addr, null, false, false);
|
||||
activeMQServer.createQueue(new QueueConfiguration(addr).setDurable(false));
|
||||
session = sessionFactory.createSession(true, true);
|
||||
producer = session.createProducer(addr);
|
||||
session.start();
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Map;
|
|||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.core.server.metrics.ActiveMQMetricsPlugin;
|
||||
import org.apache.activemq.artemis.core.server.plugin.ActiveMQServerFederationPlugin;
|
||||
import org.apache.activemq.artemis.core.server.plugin.ActiveMQServerAddressPlugin;
|
||||
|
@ -463,15 +464,28 @@ public interface Configuration {
|
|||
/**
|
||||
* Returns the queues configured for this server.
|
||||
*/
|
||||
@Deprecated
|
||||
List<CoreQueueConfiguration> getQueueConfigurations();
|
||||
|
||||
|
||||
List<QueueConfiguration> getQueueConfigs();
|
||||
|
||||
/**
|
||||
* Sets the queues configured for this server.
|
||||
*/
|
||||
@Deprecated
|
||||
Configuration setQueueConfigurations(List<CoreQueueConfiguration> configs);
|
||||
|
||||
/**
|
||||
* Sets the queues configured for this server.
|
||||
*/
|
||||
Configuration setQueueConfigs(List<QueueConfiguration> configs);
|
||||
|
||||
@Deprecated
|
||||
Configuration addQueueConfiguration(CoreQueueConfiguration config);
|
||||
|
||||
Configuration addQueueConfiguration(QueueConfiguration config);
|
||||
|
||||
/**
|
||||
* Returns the addresses configured for this server.
|
||||
*/
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.ArrayList;
|
|||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
|
||||
public class CoreAddressConfiguration implements Serializable {
|
||||
|
@ -29,7 +30,7 @@ public class CoreAddressConfiguration implements Serializable {
|
|||
|
||||
private EnumSet<RoutingType> routingTypes = EnumSet.noneOf(RoutingType.class);
|
||||
|
||||
private List<CoreQueueConfiguration> queueConfigurations = new ArrayList<>();
|
||||
private List<QueueConfiguration> queueConfigurations = new ArrayList<>();
|
||||
|
||||
public CoreAddressConfiguration() {
|
||||
}
|
||||
|
@ -52,17 +53,39 @@ public class CoreAddressConfiguration implements Serializable {
|
|||
return this;
|
||||
}
|
||||
|
||||
public CoreAddressConfiguration setQueueConfigurations(List<CoreQueueConfiguration> queueConfigurations) {
|
||||
@Deprecated
|
||||
public CoreAddressConfiguration setQueueConfigurations(List<CoreQueueConfiguration> coreQueueConfigurations) {
|
||||
for (CoreQueueConfiguration coreQueueConfiguration : coreQueueConfigurations) {
|
||||
queueConfigurations.add(coreQueueConfiguration.toQueueConfiguration());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public CoreAddressConfiguration setQueueConfigs(List<QueueConfiguration> queueConfigurations) {
|
||||
this.queueConfigurations = queueConfigurations;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CoreAddressConfiguration addQueueConfiguration(CoreQueueConfiguration queueConfiguration) {
|
||||
this.queueConfigurations.add(queueConfiguration.toQueueConfiguration());
|
||||
return this;
|
||||
}
|
||||
|
||||
public CoreAddressConfiguration addQueueConfiguration(QueueConfiguration queueConfiguration) {
|
||||
this.queueConfigurations.add(queueConfiguration);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public List<CoreQueueConfiguration> getQueueConfigurations() {
|
||||
List<CoreQueueConfiguration> result = new ArrayList<>();
|
||||
for (QueueConfiguration queueConfiguration : queueConfigurations) {
|
||||
result.add(CoreQueueConfiguration.fromQueueConfiguration(queueConfiguration));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<QueueConfiguration> getQueueConfigs() {
|
||||
return queueConfigurations;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,10 @@ package org.apache.activemq.artemis.core.config;
|
|||
import java.io.Serializable;
|
||||
|
||||
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
|
||||
@Deprecated
|
||||
public class CoreQueueConfiguration implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 650404974977490254L;
|
||||
|
@ -124,6 +126,49 @@ public class CoreQueueConfiguration implements Serializable {
|
|||
return ringSize;
|
||||
}
|
||||
|
||||
public QueueConfiguration toQueueConfiguration() {
|
||||
return new QueueConfiguration(this.getName())
|
||||
.setAddress(this.getAddress())
|
||||
.setDurable(this.isDurable())
|
||||
.setRoutingType(this.getRoutingType())
|
||||
.setExclusive(this.isExclusive())
|
||||
.setRingSize(this.getRingSize())
|
||||
.setGroupRebalance(this.isGroupRebalance())
|
||||
.setNonDestructive(this.isNonDestructive())
|
||||
.setLastValue(this.isLastValue())
|
||||
.setFilterString(this.getFilterString())
|
||||
.setMaxConsumers(this.getMaxConsumers())
|
||||
.setPurgeOnNoConsumers(this.getPurgeOnNoConsumers())
|
||||
.setConsumersBeforeDispatch(this.getConsumersBeforeDispatch())
|
||||
.setDelayBeforeDispatch(this.getDelayBeforeDispatch())
|
||||
.setGroupBuckets(this.getGroupBuckets())
|
||||
.setGroupFirstKey(this.getGroupFirstKey())
|
||||
.setUser(this.getUser())
|
||||
.setLastValueKey(this.getLastValueKey());
|
||||
}
|
||||
|
||||
public static CoreQueueConfiguration fromQueueConfiguration(QueueConfiguration queueConfiguration) {
|
||||
return new CoreQueueConfiguration()
|
||||
.setAddress(queueConfiguration.getAddress() != null ? queueConfiguration.getAddress().toString() : null)
|
||||
.setName(queueConfiguration.getName() != null ? queueConfiguration.getName().toString() : null)
|
||||
.setFilterString(queueConfiguration.getFilterString() != null ? queueConfiguration.getFilterString().toString() : null)
|
||||
.setDurable(queueConfiguration.isDurable() != null ? queueConfiguration.isDurable() : true)
|
||||
.setUser(queueConfiguration.getUser() != null ? queueConfiguration.getUser().toString() : null)
|
||||
.setExclusive(queueConfiguration.isExclusive())
|
||||
.setGroupRebalance(queueConfiguration.isGroupRebalance())
|
||||
.setGroupBuckets(queueConfiguration.getGroupBuckets())
|
||||
.setGroupFirstKey(queueConfiguration.getGroupFirstKey() != null ? queueConfiguration.getGroupFirstKey().toString() : null)
|
||||
.setLastValue(queueConfiguration.isLastValue())
|
||||
.setLastValueKey(queueConfiguration.getLastValueKey() != null ? queueConfiguration.getLastValueKey().toString() : null)
|
||||
.setNonDestructive(queueConfiguration.isNonDestructive())
|
||||
.setMaxConsumers(queueConfiguration.getMaxConsumers())
|
||||
.setConsumersBeforeDispatch(queueConfiguration.getConsumersBeforeDispatch())
|
||||
.setDelayBeforeDispatch(queueConfiguration.getDelayBeforeDispatch())
|
||||
.setRingSize(queueConfiguration.getRingSize() != null ? queueConfiguration.getRingSize() : ActiveMQDefaultConfiguration.getDefaultRingSize())
|
||||
.setPurgeOnNoConsumers(queueConfiguration.isPurgeOnNoConsumers() != null ? queueConfiguration.isPurgeOnNoConsumers() : ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers())
|
||||
.setRoutingType(queueConfiguration.getRoutingType() != null ? queueConfiguration.getRoutingType() : ActiveMQDefaultConfiguration.getDefaultRoutingType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param address the address to set
|
||||
*/
|
||||
|
|
|
@ -43,6 +43,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.BridgeConfiguration;
|
||||
|
@ -161,7 +162,9 @@ public class ConfigurationImpl implements Configuration, Serializable {
|
|||
|
||||
protected List<FederationConfiguration> federationConfigurations = new ArrayList<>();
|
||||
|
||||
private List<CoreQueueConfiguration> queueConfigurations = new ArrayList<>();
|
||||
@Deprecated
|
||||
// this can eventually be replaced with List<QueueConfiguration>, but to keep existing semantics it must stay as is for now
|
||||
private List<CoreQueueConfiguration> coreQueueConfigurations = new ArrayList<>();
|
||||
|
||||
private List<CoreAddressConfiguration> addressConfigurations = new ArrayList<>();
|
||||
|
||||
|
@ -716,20 +719,48 @@ public class ConfigurationImpl implements Configuration, Serializable {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public List<CoreQueueConfiguration> getQueueConfigurations() {
|
||||
return queueConfigurations;
|
||||
return coreQueueConfigurations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationImpl setQueueConfigurations(final List<CoreQueueConfiguration> configs) {
|
||||
queueConfigurations = configs;
|
||||
/**
|
||||
* Note: modifying the returned {@code List} will not impact the underlying {@code List}.
|
||||
*/
|
||||
public List<QueueConfiguration> getQueueConfigs() {
|
||||
List<QueueConfiguration> result = new ArrayList<>();
|
||||
for (CoreQueueConfiguration coreQueueConfiguration : coreQueueConfigurations) {
|
||||
result.add(coreQueueConfiguration.toQueueConfiguration());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public ConfigurationImpl setQueueConfigurations(final List<CoreQueueConfiguration> coreQueueConfigurations) {
|
||||
this.coreQueueConfigurations = coreQueueConfigurations;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationImpl setQueueConfigs(final List<QueueConfiguration> configs) {
|
||||
for (QueueConfiguration queueConfiguration : configs) {
|
||||
coreQueueConfigurations.add(CoreQueueConfiguration.fromQueueConfiguration(queueConfiguration));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationImpl addQueueConfiguration(final CoreQueueConfiguration config) {
|
||||
queueConfigurations.add(config);
|
||||
coreQueueConfigurations.add(config);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationImpl addQueueConfiguration(final QueueConfiguration config) {
|
||||
coreQueueConfigurations.add(CoreQueueConfiguration.fromQueueConfiguration(config));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1873,7 +1904,7 @@ public class ConfigurationImpl implements Configuration, Serializable {
|
|||
result = prime * result + (persistDeliveryCountBeforeDelivery ? 1231 : 1237);
|
||||
result = prime * result + (persistIDCache ? 1231 : 1237);
|
||||
result = prime * result + (persistenceEnabled ? 1231 : 1237);
|
||||
result = prime * result + ((queueConfigurations == null) ? 0 : queueConfigurations.hashCode());
|
||||
// result = prime * result + ((queueConfigurations == null) ? 0 : queueConfigurations.hashCode());
|
||||
result = prime * result + scheduledThreadPoolMaxSize;
|
||||
result = prime * result + (securityEnabled ? 1231 : 1237);
|
||||
result = prime * result + (populateValidatedUser ? 1231 : 1237);
|
||||
|
@ -2087,11 +2118,11 @@ public class ConfigurationImpl implements Configuration, Serializable {
|
|||
return false;
|
||||
if (persistenceEnabled != other.persistenceEnabled)
|
||||
return false;
|
||||
if (queueConfigurations == null) {
|
||||
if (other.queueConfigurations != null)
|
||||
return false;
|
||||
} else if (!queueConfigurations.equals(other.queueConfigurations))
|
||||
return false;
|
||||
// if (queueConfigurations == null) {
|
||||
// if (other.queueConfigurations != null)
|
||||
// return false;
|
||||
// } else if (!queueConfigurations.equals(other.queueConfigurations))
|
||||
// return false;
|
||||
if (scheduledThreadPoolMaxSize != other.scheduledThreadPoolMaxSize)
|
||||
return false;
|
||||
if (securityEnabled != other.securityEnabled)
|
||||
|
|
|
@ -21,10 +21,10 @@ import java.io.InputStream;
|
|||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.core.config.Configuration;
|
||||
import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
|
||||
import org.apache.activemq.artemis.core.deployers.Deployable;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQComponent;
|
||||
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
|
||||
|
@ -176,9 +176,7 @@ public class LegacyJMSConfiguration implements Deployable {
|
|||
configuration.addAddressConfiguration(new CoreAddressConfiguration()
|
||||
.setName(queueName)
|
||||
.addRoutingType(RoutingType.ANYCAST)
|
||||
.addQueueConfiguration(new CoreQueueConfiguration()
|
||||
.setAddress(queueName)
|
||||
.setName(queueName)
|
||||
.addQueueConfiguration(new QueueConfiguration(queueName)
|
||||
.setFilterString(selectorString)
|
||||
.setDurable(durable)
|
||||
.setRoutingType(RoutingType.ANYCAST)));
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration;
|
|||
import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.JGroupsFileBroadcastEndpointFactory;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
|
@ -50,7 +51,6 @@ import org.apache.activemq.artemis.core.config.Configuration;
|
|||
import org.apache.activemq.artemis.core.config.ConfigurationUtils;
|
||||
import org.apache.activemq.artemis.core.config.ConnectorServiceConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.DivertConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.FederationConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.ScaleDownConfiguration;
|
||||
|
@ -826,15 +826,15 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
|
|||
NodeList elements = e.getElementsByTagName("queues");
|
||||
if (elements.getLength() != 0) {
|
||||
Element node = (Element) elements.item(0);
|
||||
config.setQueueConfigurations(parseQueueConfigurations(node, ActiveMQDefaultConfiguration.DEFAULT_ROUTING_TYPE));
|
||||
config.setQueueConfigs(parseQueueConfigurations(node, ActiveMQDefaultConfiguration.DEFAULT_ROUTING_TYPE));
|
||||
}
|
||||
}
|
||||
|
||||
private List<CoreQueueConfiguration> parseQueueConfigurations(final Element node, RoutingType routingType) {
|
||||
List<CoreQueueConfiguration> queueConfigurations = new ArrayList<>();
|
||||
private List<QueueConfiguration> parseQueueConfigurations(final Element node, RoutingType routingType) {
|
||||
List<QueueConfiguration> queueConfigurations = new ArrayList<>();
|
||||
NodeList list = node.getElementsByTagName("queue");
|
||||
for (int i = 0; i < list.getLength(); i++) {
|
||||
CoreQueueConfiguration queueConfig = parseQueueConfiguration(list.item(i));
|
||||
QueueConfiguration queueConfig = parseQueueConfiguration(list.item(i));
|
||||
queueConfig.setRoutingType(routingType);
|
||||
queueConfigurations.add(queueConfig);
|
||||
}
|
||||
|
@ -1235,7 +1235,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
|
|||
return resourceLimitSettings;
|
||||
}
|
||||
|
||||
protected CoreQueueConfiguration parseQueueConfiguration(final Node node) {
|
||||
protected QueueConfiguration parseQueueConfiguration(final Node node) {
|
||||
String name = getAttributeValue(node, "name");
|
||||
String address = null;
|
||||
String filterString = null;
|
||||
|
@ -1300,9 +1300,8 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
|
|||
}
|
||||
}
|
||||
|
||||
return new CoreQueueConfiguration()
|
||||
return new QueueConfiguration(name)
|
||||
.setAddress(address)
|
||||
.setName(name)
|
||||
.setFilterString(filterString)
|
||||
.setDurable(durable)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
|
@ -1326,7 +1325,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
|
|||
String name = getAttributeValue(node, "name");
|
||||
addressConfiguration.setName(name);
|
||||
|
||||
List<CoreQueueConfiguration> queueConfigurations = new ArrayList<>();
|
||||
List<QueueConfiguration> queueConfigurations = new ArrayList<>();
|
||||
NodeList children = node.getChildNodes();
|
||||
for (int j = 0; j < children.getLength(); j++) {
|
||||
Node child = children.item(j);
|
||||
|
@ -1339,11 +1338,11 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
|
|||
}
|
||||
}
|
||||
|
||||
for (CoreQueueConfiguration coreQueueConfiguration : queueConfigurations) {
|
||||
coreQueueConfiguration.setAddress(name);
|
||||
for (QueueConfiguration queueConfiguration : queueConfigurations) {
|
||||
queueConfiguration.setAddress(name);
|
||||
}
|
||||
|
||||
addressConfiguration.setQueueConfigurations(queueConfigurations);
|
||||
addressConfiguration.setQueueConfigs(queueConfigurations);
|
||||
return addressConfiguration;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.JsonUtil;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
|
@ -935,10 +936,12 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
}
|
||||
checkStarted();
|
||||
|
||||
SimpleString filter = filterStr == null ? null : new SimpleString(filterStr);
|
||||
clearIO();
|
||||
try {
|
||||
server.createQueue(SimpleString.toSimpleString(address), server.getAddressSettingsRepository().getMatch(address).getDefaultQueueRoutingType(), new SimpleString(name), filter, durable, false);
|
||||
server.createQueue(new QueueConfiguration(name)
|
||||
.setName(name)
|
||||
.setFilterString(filterStr)
|
||||
.setDurable(durable));
|
||||
} finally {
|
||||
blockOnIO();
|
||||
}
|
||||
|
@ -1179,7 +1182,27 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
filter = new SimpleString(filterStr);
|
||||
}
|
||||
|
||||
final Queue queue = server.createQueue(SimpleString.toSimpleString(address), RoutingType.valueOf(routingType.toUpperCase()), SimpleString.toSimpleString(name), filter, durable, false, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, SimpleString.toSimpleString(groupFirstKey), lastValue, SimpleString.toSimpleString(lastValueKey), nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, ringSize);
|
||||
final Queue queue = server.createQueue(new QueueConfiguration(name)
|
||||
.setAddress(address)
|
||||
.setRoutingType(RoutingType.valueOf(routingType.toUpperCase()))
|
||||
.setFilterString(filter)
|
||||
.setDurable(durable)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setGroupRebalance(groupRebalance)
|
||||
.setGroupBuckets(groupBuckets)
|
||||
.setGroupFirstKey(groupFirstKey)
|
||||
.setLastValue(lastValue)
|
||||
.setLastValueKey(lastValueKey)
|
||||
.setNonDestructive(nonDestructive)
|
||||
.setConsumersBeforeDispatch(consumersBeforeDispatch)
|
||||
.setDelayBeforeDispatch(delayBeforeDispatch)
|
||||
.setAutoDelete(autoDelete)
|
||||
.setAutoDeleteDelay(autoDeleteDelay)
|
||||
.setAutoDeleteMessageCount(autoDeleteMessageCount)
|
||||
.setAutoCreateAddress(autoCreateAddress)
|
||||
.setRingSize(ringSize));
|
||||
return QueueTextFormatter.Long.format(queue, new StringBuilder()).toString();
|
||||
} catch (ActiveMQException e) {
|
||||
throw new IllegalStateException(e.getMessage());
|
||||
|
@ -1188,6 +1211,60 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQueue(String queueConfigurationAsJson) throws Exception {
|
||||
return createQueue(queueConfigurationAsJson, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQueue(String queueConfigurationAsJson, boolean ignoreIfExists) throws Exception {
|
||||
if (AuditLogger.isEnabled()) {
|
||||
AuditLogger.createQueue(this.server, null, queueConfigurationAsJson, ignoreIfExists);
|
||||
}
|
||||
checkStarted();
|
||||
|
||||
clearIO();
|
||||
|
||||
try {
|
||||
// when the QueueConfiguration is passed through createQueue all of its defaults get set which we return to the caller
|
||||
QueueConfiguration queueConfiguration = QueueConfiguration.fromJSON(queueConfigurationAsJson);
|
||||
if (queueConfiguration == null) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.failedToParseJson(queueConfigurationAsJson);
|
||||
}
|
||||
server.createQueue(queueConfiguration, ignoreIfExists);
|
||||
return queueConfiguration.toJSON();
|
||||
} catch (ActiveMQException e) {
|
||||
throw new IllegalStateException(e.getMessage());
|
||||
} finally {
|
||||
blockOnIO();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateQueue(String queueConfigurationAsJson) throws Exception {
|
||||
|
||||
if (AuditLogger.isEnabled()) {
|
||||
AuditLogger.updateQueue(this.server, queueConfigurationAsJson);
|
||||
}
|
||||
checkStarted();
|
||||
|
||||
clearIO();
|
||||
|
||||
try {
|
||||
QueueConfiguration queueConfiguration = QueueConfiguration.fromJSON(queueConfigurationAsJson);
|
||||
if (queueConfiguration == null) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.failedToParseJson(queueConfigurationAsJson);
|
||||
}
|
||||
final Queue queue = server.updateQueue(queueConfiguration);
|
||||
if (queue == null) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(queueConfiguration.getName());
|
||||
}
|
||||
return server.locateQueue(queueConfiguration.getName()).getQueueConfiguration().toJSON();
|
||||
} finally {
|
||||
blockOnIO();
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public String updateQueue(String name,
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Set;
|
|||
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.filter.Filter;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQComponent;
|
||||
|
@ -65,6 +66,7 @@ public interface PostOffice extends ActiveMQComponent {
|
|||
|
||||
AddressInfo updateAddressInfo(SimpleString addressName, EnumSet<RoutingType> routingTypes) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
QueueBinding updateQueue(SimpleString name,
|
||||
RoutingType routingType,
|
||||
Filter filter,
|
||||
|
@ -80,6 +82,7 @@ public interface PostOffice extends ActiveMQComponent {
|
|||
SimpleString user,
|
||||
Boolean configurationManaged) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
QueueBinding updateQueue(SimpleString name,
|
||||
RoutingType routingType,
|
||||
Filter filter,
|
||||
|
@ -96,6 +99,8 @@ public interface PostOffice extends ActiveMQComponent {
|
|||
Boolean configurationManaged,
|
||||
Long ringSize) throws Exception;
|
||||
|
||||
QueueBinding updateQueue(QueueConfiguration queueConfiguration) throws Exception;
|
||||
|
||||
List<Queue> listQueuesForAddress(SimpleString address) throws Exception;
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQDuplicateIdException;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
|
||||
|
@ -46,6 +47,7 @@ import org.apache.activemq.artemis.api.core.management.ResourceNames;
|
|||
import org.apache.activemq.artemis.core.config.DivertConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.WildcardConfiguration;
|
||||
import org.apache.activemq.artemis.core.filter.Filter;
|
||||
import org.apache.activemq.artemis.core.filter.impl.FilterImpl;
|
||||
import org.apache.activemq.artemis.core.io.IOCallback;
|
||||
import org.apache.activemq.artemis.core.message.impl.CoreMessage;
|
||||
import org.apache.activemq.artemis.core.paging.PagingManager;
|
||||
|
@ -511,60 +513,19 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
|
|||
.addRoutingType(RoutingType.ANYCAST)
|
||||
.setInternal(false);
|
||||
addAddressInfo(addressInfo);
|
||||
AddressSettings addressSettings = addressSettingsRepository.getMatch(internalAddressName.toString());
|
||||
server.createQueue(internalAddressName,
|
||||
RoutingType.MULTICAST,
|
||||
internalMulticastQueueName,
|
||||
null,
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
addressSettings.getDefaultGroupBuckets(),
|
||||
null,
|
||||
addressSettings.isDefaultLastValueQueue(),
|
||||
addressSettings.getDefaultLastValueKey(),
|
||||
false,
|
||||
0,
|
||||
0L,
|
||||
false,
|
||||
0L,
|
||||
0L,
|
||||
false,
|
||||
retroactiveMessageCount);
|
||||
|
||||
server.createQueue(internalAddressName,
|
||||
RoutingType.ANYCAST,
|
||||
internalAnycastQueueName,
|
||||
null,
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
addressSettings.getDefaultGroupBuckets(),
|
||||
null,
|
||||
addressSettings.isDefaultLastValueQueue(),
|
||||
addressSettings.getDefaultLastValueKey(),
|
||||
false,
|
||||
0,
|
||||
0L,
|
||||
false,
|
||||
0L,
|
||||
0L,
|
||||
false,
|
||||
retroactiveMessageCount);
|
||||
server.createQueue(new QueueConfiguration(internalMulticastQueueName)
|
||||
.setAddress(internalAddressName)
|
||||
.setRoutingType(RoutingType.MULTICAST)
|
||||
.setMaxConsumers(0)
|
||||
.setRingSize(retroactiveMessageCount));
|
||||
|
||||
server.createQueue(new QueueConfiguration(internalAnycastQueueName)
|
||||
.setAddress(internalAddressName)
|
||||
.setRoutingType(RoutingType.ANYCAST)
|
||||
.setMaxConsumers(0)
|
||||
.setRingSize(retroactiveMessageCount));
|
||||
|
||||
}
|
||||
server.deployDivert(new DivertConfiguration()
|
||||
.setName(internalDivertName.toString())
|
||||
|
@ -600,6 +561,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public QueueBinding updateQueue(SimpleString name,
|
||||
RoutingType routingType,
|
||||
Filter filter,
|
||||
|
@ -618,6 +580,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public QueueBinding updateQueue(SimpleString name,
|
||||
RoutingType routingType,
|
||||
Filter filter,
|
||||
|
@ -633,8 +596,27 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
|
|||
SimpleString user,
|
||||
Boolean configurationManaged,
|
||||
Long ringSize) throws Exception {
|
||||
return updateQueue(new QueueConfiguration(name)
|
||||
.setRoutingType(routingType)
|
||||
.setFilterString(filter.getFilterString())
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setGroupRebalance(groupRebalance)
|
||||
.setGroupBuckets(groupBuckets)
|
||||
.setGroupFirstKey(groupFirstKey)
|
||||
.setNonDestructive(nonDestructive)
|
||||
.setConsumersBeforeDispatch(consumersBeforeDispatch)
|
||||
.setDelayBeforeDispatch(delayBeforeDispatch)
|
||||
.setUser(user)
|
||||
.setConfigurationManaged(configurationManaged)
|
||||
.setRingSize(ringSize));
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueueBinding updateQueue(QueueConfiguration queueConfiguration) throws Exception {
|
||||
synchronized (this) {
|
||||
final QueueBinding queueBinding = (QueueBinding) addressManager.getBinding(name);
|
||||
final QueueBinding queueBinding = (QueueBinding) addressManager.getBinding(queueConfiguration.getName());
|
||||
if (queueBinding == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -648,82 +630,83 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
|
|||
boolean changed = false;
|
||||
|
||||
//validate update
|
||||
if (maxConsumers != null && maxConsumers.intValue() != Queue.MAX_CONSUMERS_UNLIMITED) {
|
||||
if (queueConfiguration.getMaxConsumers() != null && queueConfiguration.getMaxConsumers().intValue() != Queue.MAX_CONSUMERS_UNLIMITED) {
|
||||
final int consumerCount = queue.getConsumerCount();
|
||||
if (consumerCount > maxConsumers) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.invalidMaxConsumersUpdate(name.toString(), maxConsumers, consumerCount);
|
||||
if (consumerCount > queueConfiguration.getMaxConsumers()) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.invalidMaxConsumersUpdate(queueConfiguration.getName().toString(), queueConfiguration.getMaxConsumers(), consumerCount);
|
||||
}
|
||||
}
|
||||
if (routingType != null) {
|
||||
if (queueConfiguration.getRoutingType() != null) {
|
||||
final SimpleString address = queue.getAddress();
|
||||
final AddressInfo addressInfo = addressManager.getAddressInfo(address);
|
||||
final EnumSet<RoutingType> addressRoutingTypes = addressInfo.getRoutingTypes();
|
||||
if (!addressRoutingTypes.contains(routingType)) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeUpdate(name.toString(), routingType, address.toString(), addressRoutingTypes);
|
||||
if (!addressRoutingTypes.contains(queueConfiguration.getRoutingType())) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeUpdate(queueConfiguration.getName().toString(), queueConfiguration.getRoutingType(), address.toString(), addressRoutingTypes);
|
||||
}
|
||||
}
|
||||
|
||||
//atomic update
|
||||
if (maxConsumers != null && queue.getMaxConsumers() != maxConsumers.intValue()) {
|
||||
if (queueConfiguration.getMaxConsumers() != null && queue.getMaxConsumers() != queueConfiguration.getMaxConsumers().intValue()) {
|
||||
changed = true;
|
||||
queue.setMaxConsumer(maxConsumers);
|
||||
queue.setMaxConsumer(queueConfiguration.getMaxConsumers());
|
||||
}
|
||||
if (routingType != null && queue.getRoutingType() != routingType) {
|
||||
if (queueConfiguration.getRoutingType() != null && queue.getRoutingType() != queueConfiguration.getRoutingType()) {
|
||||
changed = true;
|
||||
queue.setRoutingType(routingType);
|
||||
queue.setRoutingType(queueConfiguration.getRoutingType());
|
||||
}
|
||||
if (purgeOnNoConsumers != null && queue.isPurgeOnNoConsumers() != purgeOnNoConsumers.booleanValue()) {
|
||||
if (queueConfiguration.isPurgeOnNoConsumers() != null && queue.isPurgeOnNoConsumers() != queueConfiguration.isPurgeOnNoConsumers().booleanValue()) {
|
||||
changed = true;
|
||||
queue.setPurgeOnNoConsumers(purgeOnNoConsumers);
|
||||
queue.setPurgeOnNoConsumers(queueConfiguration.isPurgeOnNoConsumers());
|
||||
}
|
||||
if (exclusive != null && queue.isExclusive() != exclusive.booleanValue()) {
|
||||
if (queueConfiguration.isExclusive() != null && queue.isExclusive() != queueConfiguration.isExclusive().booleanValue()) {
|
||||
changed = true;
|
||||
queue.setExclusive(exclusive);
|
||||
queue.setExclusive(queueConfiguration.isExclusive());
|
||||
}
|
||||
if (groupRebalance != null && queue.isGroupRebalance() != groupRebalance.booleanValue()) {
|
||||
if (queueConfiguration.isGroupRebalance() != null && queue.isGroupRebalance() != queueConfiguration.isGroupRebalance().booleanValue()) {
|
||||
changed = true;
|
||||
queue.setGroupRebalance(groupRebalance);
|
||||
queue.setGroupRebalance(queueConfiguration.isGroupRebalance());
|
||||
}
|
||||
if (groupBuckets != null && queue.getGroupBuckets() != groupBuckets.intValue()) {
|
||||
if (queueConfiguration.getGroupBuckets() != null && queue.getGroupBuckets() != queueConfiguration.getGroupBuckets().intValue()) {
|
||||
changed = true;
|
||||
queue.setGroupBuckets(groupBuckets);
|
||||
queue.setGroupBuckets(queueConfiguration.getGroupBuckets());
|
||||
}
|
||||
if (groupFirstKey != null && !groupFirstKey.equals(queue.getGroupFirstKey())) {
|
||||
if (queueConfiguration.getGroupFirstKey() != null && !queueConfiguration.getGroupFirstKey().equals(queue.getGroupFirstKey())) {
|
||||
changed = true;
|
||||
queue.setGroupFirstKey(groupFirstKey);
|
||||
queue.setGroupFirstKey(queueConfiguration.getGroupFirstKey());
|
||||
}
|
||||
if (nonDestructive != null && queue.isNonDestructive() != nonDestructive.booleanValue()) {
|
||||
if (queueConfiguration.isNonDestructive() != null && queue.isNonDestructive() != queueConfiguration.isNonDestructive().booleanValue()) {
|
||||
changed = true;
|
||||
queue.setNonDestructive(nonDestructive);
|
||||
queue.setNonDestructive(queueConfiguration.isNonDestructive());
|
||||
}
|
||||
if (consumersBeforeDispatch != null && !consumersBeforeDispatch.equals(queue.getConsumersBeforeDispatch())) {
|
||||
if (queueConfiguration.getConsumersBeforeDispatch() != null && !queueConfiguration.getConsumersBeforeDispatch().equals(queue.getConsumersBeforeDispatch())) {
|
||||
changed = true;
|
||||
queue.setConsumersBeforeDispatch(consumersBeforeDispatch.intValue());
|
||||
queue.setConsumersBeforeDispatch(queueConfiguration.getConsumersBeforeDispatch().intValue());
|
||||
}
|
||||
if (delayBeforeDispatch != null && !delayBeforeDispatch.equals(queue.getDelayBeforeDispatch())) {
|
||||
if (queueConfiguration.getDelayBeforeDispatch() != null && !queueConfiguration.getDelayBeforeDispatch().equals(queue.getDelayBeforeDispatch())) {
|
||||
changed = true;
|
||||
queue.setDelayBeforeDispatch(delayBeforeDispatch.longValue());
|
||||
queue.setDelayBeforeDispatch(queueConfiguration.getDelayBeforeDispatch().longValue());
|
||||
}
|
||||
Filter filter = FilterImpl.createFilter(queueConfiguration.getFilterString());
|
||||
if (filter != null && !filter.equals(queue.getFilter())) {
|
||||
changed = true;
|
||||
queue.setFilter(filter);
|
||||
}
|
||||
if (configurationManaged != null && !configurationManaged.equals(queue.isConfigurationManaged())) {
|
||||
if (queueConfiguration.isConfigurationManaged() != null && !queueConfiguration.isConfigurationManaged().equals(queue.isConfigurationManaged())) {
|
||||
changed = true;
|
||||
queue.setConfigurationManaged(configurationManaged);
|
||||
queue.setConfigurationManaged(queueConfiguration.isConfigurationManaged());
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (user == null && queue.getUser() != null) {
|
||||
if (queueConfiguration.getUser() == null && queue.getUser() != null) {
|
||||
logger.debug("Ignoring updating Queue to a NULL user");
|
||||
}
|
||||
}
|
||||
if (user != null && !user.equals(queue.getUser())) {
|
||||
if (queueConfiguration.getUser() != null && !queueConfiguration.getUser().equals(queue.getUser())) {
|
||||
changed = true;
|
||||
queue.setUser(user);
|
||||
queue.setUser(queueConfiguration.getUser());
|
||||
}
|
||||
if (ringSize != null && !ringSize.equals(queue.getRingSize())) {
|
||||
if (queueConfiguration.getRingSize() != null && !queueConfiguration.getRingSize().equals(queue.getRingSize())) {
|
||||
changed = true;
|
||||
queue.setRingSize(ringSize);
|
||||
queue.setRingSize(queueConfiguration.getRingSize());
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQInternalErrorException;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQQueueMaxConsumerLimitReached;
|
||||
import org.apache.activemq.artemis.api.core.ICoreMessage;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSession;
|
||||
|
@ -348,7 +349,12 @@ public class ServerSessionPacketHandler implements ChannelHandler {
|
|||
case CREATE_QUEUE: {
|
||||
CreateQueueMessage request = (CreateQueueMessage) packet;
|
||||
requiresResponse = request.isRequiresResponse();
|
||||
session.createQueue(request.getAddress(), request.getQueueName(), getRoutingTypeFromAddress(request.getAddress()), request.getFilterString(), request.isTemporary(), request.isDurable());
|
||||
session.createQueue(new QueueConfiguration(request.getQueueName())
|
||||
.setAddress(request.getAddress())
|
||||
.setRoutingType(getRoutingTypeFromAddress(request.getAddress()))
|
||||
.setFilterString(request.getFilterString())
|
||||
.setTemporary(request.isTemporary())
|
||||
.setDurable(request.isDurable()));
|
||||
if (requiresResponse) {
|
||||
response = createNullResponseMessage(packet);
|
||||
}
|
||||
|
@ -357,9 +363,8 @@ public class ServerSessionPacketHandler implements ChannelHandler {
|
|||
case CREATE_QUEUE_V2: {
|
||||
CreateQueueMessage_V2 request = (CreateQueueMessage_V2) packet;
|
||||
requiresResponse = request.isRequiresResponse();
|
||||
session.createQueue(request.getAddress(), request.getQueueName(), request.getRoutingType(), request.getFilterString(), request.isTemporary(), request.isDurable(), request.getMaxConsumers(), request.isPurgeOnNoConsumers(),
|
||||
request.isExclusive(), request.isGroupRebalance(), request.getGroupBuckets(), request.getGroupFirstKey(), request.isLastValue(), request.getLastValueKey(), request.isNonDestructive(), request.getConsumersBeforeDispatch(), request.getDelayBeforeDispatch(),
|
||||
request.isAutoDelete(), request.getAutoDeleteDelay(), request.getAutoDeleteMessageCount(), request.isAutoCreated(), request.getRingSize());
|
||||
session.createQueue(request.toQueueConfiguration());
|
||||
|
||||
if (requiresResponse) {
|
||||
response = createNullResponseMessage(packet);
|
||||
}
|
||||
|
@ -370,7 +375,10 @@ public class ServerSessionPacketHandler implements ChannelHandler {
|
|||
requiresResponse = request.isRequiresResponse();
|
||||
QueueQueryResult result = session.executeQueueQuery(request.getQueueName());
|
||||
if (!(result.isExists() && Objects.equals(result.getAddress(), request.getAddress()) && Objects.equals(result.getFilterString(), request.getFilterString()))) {
|
||||
session.createSharedQueue(request.getAddress(), request.getQueueName(), request.isDurable(), request.getFilterString());
|
||||
session.createSharedQueue(new QueueConfiguration(request.getQueueName())
|
||||
.setAddress(request.getAddress())
|
||||
.setFilterString(request.getFilterString())
|
||||
.setDurable(request.isDurable()));
|
||||
}
|
||||
if (requiresResponse) {
|
||||
response = createNullResponseMessage(packet);
|
||||
|
@ -382,9 +390,7 @@ public class ServerSessionPacketHandler implements ChannelHandler {
|
|||
requiresResponse = request.isRequiresResponse();
|
||||
QueueQueryResult result = session.executeQueueQuery(request.getQueueName());
|
||||
if (!(result.isExists() && Objects.equals(result.getAddress(), request.getAddress()) && Objects.equals(result.getFilterString(), request.getFilterString()))) {
|
||||
session.createSharedQueue(request.getAddress(), request.getQueueName(), request.getRoutingType(), request.getFilterString(), request.isDurable(), request.getMaxConsumers(), request.isPurgeOnNoConsumers(),
|
||||
request.isExclusive(), request.isGroupRebalance(), request.getGroupBuckets(), request.getGroupFirstKey(), request.isLastValue(), request.getLastValueKey(), request.isNonDestructive(), request.getConsumersBeforeDispatch(), request.getDelayBeforeDispatch(),
|
||||
request.isAutoDelete(), request.getAutoDeleteDelay(), request.getAutoDeleteMessageCount());
|
||||
session.createSharedQueue(request.toQueueConfiguration());
|
||||
}
|
||||
if (requiresResponse) {
|
||||
response = createNullResponseMessage(packet);
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQInternalErrorException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQSecurityException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.persistence.OperationContext;
|
||||
|
@ -247,7 +248,11 @@ public class ActiveMQPacketHandler implements ChannelHandler {
|
|||
|
||||
private void handleCreateQueue(final CreateQueueMessage request) {
|
||||
try {
|
||||
server.createQueue(request.getAddress(), null, request.getQueueName(), request.getFilterString(), request.isDurable(), request.isTemporary());
|
||||
server.createQueue(new QueueConfiguration(request.getQueueName())
|
||||
.setAddress(request.getAddress())
|
||||
.setFilterString(request.getFilterString())
|
||||
.setDurable(request.isDurable())
|
||||
.setTemporary(request.isTemporary()));
|
||||
} catch (Exception e) {
|
||||
ActiveMQServerLogger.LOGGER.failedToHandleCreateQueue(e);
|
||||
}
|
||||
|
|
|
@ -482,4 +482,7 @@ public interface ActiveMQMessageBundle {
|
|||
|
||||
@Message(id = 229228, value = "{0} must be less than or equal to 1 (actual value: {1})", format = Message.Format.MESSAGE_FORMAT)
|
||||
IllegalArgumentException lessThanOrEqualToOne(String name, Number val);
|
||||
|
||||
@Message(id = 229229, value = "Failed to parse JSON queue configuration: {0}", format = Message.Format.MESSAGE_FORMAT)
|
||||
IllegalArgumentException failedToParseJson(String json);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.config.BridgeConfiguration;
|
||||
|
@ -402,91 +403,109 @@ public interface ActiveMQServer extends ServiceComponent {
|
|||
* @throws org.apache.activemq.artemis.api.core.ActiveMQInvalidTransientQueueUseException if the shared queue already exists with a different {@code address} or {@code filterString}
|
||||
* @throws NullPointerException if {@code address} is {@code null}
|
||||
*/
|
||||
@Deprecated
|
||||
void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString name, SimpleString filterString,
|
||||
SimpleString user, boolean durable) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString name, SimpleString filterString,
|
||||
SimpleString user, boolean durable, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean lastValue) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString name, SimpleString filterString,
|
||||
SimpleString user, boolean durable, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive,
|
||||
boolean groupRebalance, int groupBuckets, boolean lastValue,
|
||||
SimpleString lastValueKey, boolean nonDestructive, int consumersBeforeDispatch, long delayBeforeDispatch,
|
||||
boolean autoDelete, long autoDeleteTimeout, long autoDeleteMessageCount) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
boolean durable, boolean temporary) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString user,
|
||||
SimpleString filterString, boolean durable, boolean temporary) throws Exception;
|
||||
|
||||
Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
boolean durable, boolean temporary, int maxConsumers, boolean purgeOnNoConsumers,
|
||||
boolean autoCreateAddress) throws Exception;
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean temporary, int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreateAddress) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
boolean durable, boolean temporary, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance, int groupBuckets,
|
||||
boolean lastValue, SimpleString lastValueKey, boolean nonDestructive, int consumersBeforeDispatch, long delayBeforeDispatch,
|
||||
boolean autoDelete, long autoDeleteDelay, long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
boolean durable, boolean temporary, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance, int groupBuckets, SimpleString groupFirstKey,
|
||||
boolean lastValue, SimpleString lastValueKey, boolean nonDestructive, int consumersBeforeDispatch, long delayBeforeDispatch,
|
||||
boolean autoDelete, long autoDeleteDelay, long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
boolean durable, boolean temporary, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance, int groupBuckets, SimpleString groupFirstKey,
|
||||
boolean lastValue, SimpleString lastValueKey, boolean nonDestructive, int consumersBeforeDispatch, long delayBeforeDispatch,
|
||||
boolean autoDelete, long autoDeleteDelay, long autoDeleteMessageCount, boolean autoCreateAddress, long ringSize) throws Exception;
|
||||
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers,
|
||||
Boolean purgeOnNoConsumers, boolean autoCreateAddress) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter,
|
||||
SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers,
|
||||
Boolean purgeOnNoConsumers, boolean autoCreateAddress) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter,
|
||||
SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers,
|
||||
Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue, boolean autoCreateAddress) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter,
|
||||
SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers,
|
||||
Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive,
|
||||
Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter,
|
||||
SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers,
|
||||
Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive,
|
||||
Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter,
|
||||
SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers,
|
||||
Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive,
|
||||
Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreateAddress, Long ringSize) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue,
|
||||
boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreateAddress) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue,
|
||||
boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean lastValue, boolean autoCreateAddress) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue,
|
||||
boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance,
|
||||
int groupBuckets, boolean lastValue, SimpleString lastValueKey, boolean nonDestructive,
|
||||
int consumersBeforeDispatch, long delayBeforeDispatch, boolean autoDelete, long autoDeleteDelay, long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue,
|
||||
boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance,
|
||||
int groupBuckets, SimpleString groupFirstKey, boolean lastValue, SimpleString lastValueKey, boolean nonDestructive,
|
||||
int consumersBeforeDispatch, long delayBeforeDispatch, boolean autoDelete, long autoDeleteDelay, long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue,
|
||||
boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance,
|
||||
|
@ -502,6 +521,71 @@ public interface ActiveMQServer extends ServiceComponent {
|
|||
@Deprecated
|
||||
Queue deployQueue(SimpleString address, SimpleString queue, SimpleString filter, boolean durable, boolean temporary) throws Exception;
|
||||
|
||||
/**
|
||||
* Overloaded version of {@link ActiveMQServer#createQueue(QueueConfiguration, boolean)} where the {@code boolean}
|
||||
* parameter is always {@code false} (i.e. if the queue already exists then an exception will be thrown).
|
||||
*
|
||||
* @see ActiveMQServer#createQueue(QueueConfiguration, boolean)
|
||||
*/
|
||||
Queue createQueue(QueueConfiguration queueConfiguration) throws Exception;
|
||||
|
||||
/**
|
||||
* This method creates a queue based on the {@link QueueConfiguration} input. See {@link QueueConfiguration} for more
|
||||
* details on configuration specifics.
|
||||
* <p>
|
||||
* Some dynamic defaults will be enforced via address-settings for the corresponding unset properties:
|
||||
* <p><ul>
|
||||
* <li>{@code maxConsumers}
|
||||
* <li>{@code exclusive}
|
||||
* <li>{@code groupRebalance}
|
||||
* <li>{@code groupBuckets}
|
||||
* <li>{@code groupFirstKey}
|
||||
* <li>{@code lastValue}
|
||||
* <li>{@code lastValueKey}
|
||||
* <li>{@code nonDestructive}
|
||||
* <li>{@code consumersBeforeDispatch}
|
||||
* <li>{@code delayBeforeDispatch}
|
||||
* <li>{@code ringSize}
|
||||
* <li>{@code routingType}
|
||||
* <li>{@code purgeOnNoConsumers}
|
||||
* <li>{@code autoCreateAddress}
|
||||
* <li>{@code autoDelete} (only set if queue was auto-created)
|
||||
* <li>{@code autoDeleteDelay}
|
||||
* <li>{@code autoDeleteMessageCount}
|
||||
* </ul><p>
|
||||
*
|
||||
* @param queueConfiguration the configuration to use when creating the queue
|
||||
* @param ignoreIfExists whether or not to simply return without an exception if the queue exists
|
||||
* @return the {@code Queue} instance that was created
|
||||
* @throws Exception
|
||||
*/
|
||||
Queue createQueue(QueueConfiguration queueConfiguration, boolean ignoreIfExists) throws Exception;
|
||||
|
||||
/**
|
||||
* This method is essentially the same as {@link #createQueue(QueueConfiguration, boolean)} with a few key exceptions.
|
||||
* <p>
|
||||
* If {@code durable} is {@code true} then:
|
||||
* <p><ul>
|
||||
* <li>{@code transient} will be forced to {@code false}
|
||||
* <li>{@code temporary} will be forced to {@code false}
|
||||
* </ul><p>
|
||||
* If {@code durable} is {@code false} then:
|
||||
* <p><ul>
|
||||
* <li>{@code transient} will be forced to {@code true}
|
||||
* <li>{@code temporary} will be forced to {@code true}
|
||||
* </ul><p>
|
||||
* In all instances {@code autoCreated} will be forced to {@code false} and {@code autoCreatedAddress} will be forced
|
||||
* to {@code true}.
|
||||
*
|
||||
* The {@code boolean} passed to {@link #createQueue(QueueConfiguration, boolean)} will always be true;
|
||||
*
|
||||
* @see #createQueue(QueueConfiguration, boolean)
|
||||
*
|
||||
* @throws org.apache.activemq.artemis.api.core.ActiveMQInvalidTransientQueueUseException if the shared queue already exists with a different {@code address} or {@code filterString}
|
||||
*/
|
||||
void createSharedQueue(QueueConfiguration queueConfiguration) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
void createSharedQueue(SimpleString address,
|
||||
RoutingType routingType,
|
||||
SimpleString name,
|
||||
|
@ -605,17 +689,20 @@ public interface ActiveMQServer extends ServiceComponent {
|
|||
|
||||
void stop(boolean failoverOnServerShutdown, boolean isExit) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue updateQueue(String name,
|
||||
RoutingType routingType,
|
||||
Integer maxConsumers,
|
||||
Boolean purgeOnNoConsumers) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue updateQueue(String name,
|
||||
RoutingType routingType,
|
||||
Integer maxConsumers,
|
||||
Boolean purgeOnNoConsumers,
|
||||
Boolean exclusive) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue updateQueue(String name,
|
||||
RoutingType routingType,
|
||||
Integer maxConsumers,
|
||||
|
@ -623,6 +710,7 @@ public interface ActiveMQServer extends ServiceComponent {
|
|||
Boolean exclusive,
|
||||
String user) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue updateQueue(String name,
|
||||
RoutingType routingType,
|
||||
String filterString,
|
||||
|
@ -636,6 +724,7 @@ public interface ActiveMQServer extends ServiceComponent {
|
|||
Long delayBeforeDispatch,
|
||||
String user) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue updateQueue(String name,
|
||||
RoutingType routingType,
|
||||
String filterString,
|
||||
|
@ -650,6 +739,7 @@ public interface ActiveMQServer extends ServiceComponent {
|
|||
Long delayBeforeDispatch,
|
||||
String user) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue updateQueue(String name,
|
||||
RoutingType routingType,
|
||||
String filterString,
|
||||
|
@ -665,6 +755,34 @@ public interface ActiveMQServer extends ServiceComponent {
|
|||
String user,
|
||||
Long ringSize) throws Exception;
|
||||
|
||||
/**
|
||||
* Update the queue named in the {@code QueueConfiguration} with the corresponding properties. Set only the
|
||||
* properties that you wish to change from their existing values. Only the following properties can actually be
|
||||
* updated:
|
||||
* <p><ul>
|
||||
* <li>{@code routingType}
|
||||
* <li>{@code filter}
|
||||
* <li>{@code maxConsumers}
|
||||
* <li>{@code purgeOnNoConsumers}
|
||||
* <li>{@code exclusive}
|
||||
* <li>{@code nonDestructive}
|
||||
* <li>{@code groupRebalance}
|
||||
* <li>{@code groupFirstKey}
|
||||
* <li>{@code groupBuckets}
|
||||
* <li>{@code consumersBeforeDispatch}
|
||||
* <li>{@code delayBeforeDispatch}
|
||||
* <li>{@code configurationManaged}
|
||||
* <li>{@code user}
|
||||
* <li>{@code ringSize}
|
||||
* </ul>
|
||||
* The other configuration attributes are immutable and will be ignored if set.
|
||||
*
|
||||
* @param queueConfiguration the {@code QueueConfiguration} to use
|
||||
* @return the updated {@code Queue} instance
|
||||
* @throws Exception
|
||||
*/
|
||||
Queue updateQueue(QueueConfiguration queueConfiguration) throws Exception;
|
||||
|
||||
/*
|
||||
* add a ProtocolManagerFactory to be used. Note if @see Configuration#isResolveProtocols is tur then this factory will
|
||||
* replace any factories with the same protocol
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.concurrent.Executor;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.filter.Filter;
|
||||
|
@ -469,4 +470,7 @@ public interface Queue extends Bindable,CriticalComponent {
|
|||
|
||||
}
|
||||
|
||||
default QueueConfiguration getQueueConfiguration() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,14 +17,18 @@
|
|||
package org.apache.activemq.artemis.core.server;
|
||||
|
||||
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.filter.Filter;
|
||||
import org.apache.activemq.artemis.core.filter.FilterUtils;
|
||||
import org.apache.activemq.artemis.core.filter.impl.FilterImpl;
|
||||
import org.apache.activemq.artemis.core.paging.PagingManager;
|
||||
import org.apache.activemq.artemis.core.paging.PagingStore;
|
||||
import org.apache.activemq.artemis.core.paging.cursor.PageSubscription;
|
||||
|
||||
@Deprecated
|
||||
public final class QueueConfig {
|
||||
|
||||
private final long id;
|
||||
|
@ -55,6 +59,7 @@ public final class QueueConfig {
|
|||
private final long autoDeleteMessageCount;
|
||||
private final long ringSize;
|
||||
|
||||
@Deprecated
|
||||
public static final class Builder {
|
||||
|
||||
private final long id;
|
||||
|
@ -366,6 +371,36 @@ public final class QueueConfig {
|
|||
this.configurationManaged = configurationManaged;
|
||||
}
|
||||
|
||||
public static QueueConfig fromQueueConfiguration(QueueConfiguration queueConfiguration) throws ActiveMQException {
|
||||
return new QueueConfig(queueConfiguration.getId() == null ? 0 : queueConfiguration.getId(),
|
||||
queueConfiguration.getAddress(),
|
||||
queueConfiguration.getName(),
|
||||
queueConfiguration.getFilterString() == null ? null : FilterImpl.createFilter(queueConfiguration.getFilterString()),
|
||||
null,
|
||||
null,
|
||||
queueConfiguration.getUser(),
|
||||
queueConfiguration.isDurable(),
|
||||
queueConfiguration.isTemporary(),
|
||||
queueConfiguration.isAutoCreated(),
|
||||
queueConfiguration.getRoutingType(),
|
||||
queueConfiguration.getMaxConsumers(),
|
||||
queueConfiguration.isExclusive(),
|
||||
queueConfiguration.isLastValue(),
|
||||
queueConfiguration.getLastValueKey(),
|
||||
queueConfiguration.isNonDestructive(),
|
||||
queueConfiguration.getConsumersBeforeDispatch(),
|
||||
queueConfiguration.getDelayBeforeDispatch(),
|
||||
queueConfiguration.isPurgeOnNoConsumers(),
|
||||
queueConfiguration.isGroupRebalance(),
|
||||
queueConfiguration.getGroupBuckets(),
|
||||
queueConfiguration.getGroupFirstKey(),
|
||||
queueConfiguration.isAutoDelete(),
|
||||
queueConfiguration.getAutoDeleteDelay(),
|
||||
queueConfiguration.getAutoDeleteMessageCount(),
|
||||
queueConfiguration.getRingSize(),
|
||||
queueConfiguration.isConfigurationManaged());
|
||||
}
|
||||
|
||||
public long id() {
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -16,8 +16,10 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.core.server;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.filter.Filter;
|
||||
import org.apache.activemq.artemis.core.paging.PagingManager;
|
||||
import org.apache.activemq.artemis.core.paging.cursor.PageSubscription;
|
||||
import org.apache.activemq.artemis.core.postoffice.PostOffice;
|
||||
|
||||
|
@ -29,8 +31,11 @@ import org.apache.activemq.artemis.core.postoffice.PostOffice;
|
|||
*/
|
||||
public interface QueueFactory {
|
||||
|
||||
@Deprecated
|
||||
Queue createQueueWith(QueueConfig config) throws Exception;
|
||||
|
||||
Queue createQueueWith(QueueConfiguration config, PagingManager pagingManager) throws Exception;
|
||||
|
||||
/**
|
||||
* @deprecated Replaced by {@link #createQueueWith}
|
||||
*/
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.concurrent.Executor;
|
|||
import org.apache.activemq.artemis.Closeable;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.persistence.OperationContext;
|
||||
|
@ -120,6 +121,7 @@ public interface ServerSession extends SecurityAuth {
|
|||
*/
|
||||
void resetTX(Transaction transaction);
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
RoutingType routingType,
|
||||
|
@ -127,6 +129,7 @@ public interface ServerSession extends SecurityAuth {
|
|||
boolean temporary,
|
||||
boolean durable) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(AddressInfo address,
|
||||
SimpleString name,
|
||||
SimpleString filterString,
|
||||
|
@ -144,12 +147,14 @@ public interface ServerSession extends SecurityAuth {
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
SimpleString filterString,
|
||||
boolean temporary,
|
||||
boolean durable) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
RoutingType routingType,
|
||||
|
@ -160,6 +165,7 @@ public interface ServerSession extends SecurityAuth {
|
|||
boolean purgeOnNoConsumers,
|
||||
boolean autoCreated) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
RoutingType routingType,
|
||||
|
@ -172,6 +178,7 @@ public interface ServerSession extends SecurityAuth {
|
|||
Boolean lastValue,
|
||||
boolean autoCreated) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
RoutingType routingType,
|
||||
|
@ -193,6 +200,7 @@ public interface ServerSession extends SecurityAuth {
|
|||
Long autoDeleteMessageCount,
|
||||
boolean autoCreated) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
RoutingType routingType,
|
||||
|
@ -215,6 +223,7 @@ public interface ServerSession extends SecurityAuth {
|
|||
Long autoDeleteMessageCount,
|
||||
boolean autoCreated) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
RoutingType routingType,
|
||||
|
@ -238,6 +247,7 @@ public interface ServerSession extends SecurityAuth {
|
|||
boolean autoCreated,
|
||||
Long ringSize) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
RoutingType routingType,
|
||||
|
@ -246,6 +256,7 @@ public interface ServerSession extends SecurityAuth {
|
|||
boolean durable,
|
||||
boolean autoCreated) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(AddressInfo addressInfo,
|
||||
SimpleString name,
|
||||
SimpleString filterString,
|
||||
|
@ -253,6 +264,7 @@ public interface ServerSession extends SecurityAuth {
|
|||
boolean durable,
|
||||
boolean autoCreated) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
Queue createQueue(AddressInfo addressInfo,
|
||||
SimpleString name,
|
||||
SimpleString filterString,
|
||||
|
@ -262,6 +274,22 @@ public interface ServerSession extends SecurityAuth {
|
|||
Boolean lastValue,
|
||||
boolean autoCreated) throws Exception;
|
||||
|
||||
/**
|
||||
* This method invokes {@link ActiveMQServer#createQueue(QueueConfiguration)} with a few client-specific additions:
|
||||
* <p><ul>
|
||||
* <li>set the routing type based on the prefixes configured on the acceptor used by the client
|
||||
* <li>strip any prefixes from the address & queue names (if applicable)
|
||||
* <li>check authorization based on the client's credentials
|
||||
* <li>enforce queue creation resource limit
|
||||
* <li>set up callbacks to clean up temporary queues once the client disconnects
|
||||
* </ul>
|
||||
*
|
||||
* @param queueConfiguration the configuration to use when creating the queue
|
||||
* @return the {@code Queue} instance that was created
|
||||
* @throws Exception
|
||||
*/
|
||||
Queue createQueue(QueueConfiguration queueConfiguration) throws Exception;
|
||||
|
||||
AddressInfo createAddress(SimpleString address,
|
||||
EnumSet<RoutingType> routingTypes,
|
||||
boolean autoCreated) throws Exception;
|
||||
|
@ -367,6 +395,7 @@ public interface ServerSession extends SecurityAuth {
|
|||
|
||||
boolean isClosed();
|
||||
|
||||
@Deprecated
|
||||
void createSharedQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
RoutingType routingType,
|
||||
|
@ -377,6 +406,7 @@ public interface ServerSession extends SecurityAuth {
|
|||
Boolean exclusive,
|
||||
Boolean lastValue) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
void createSharedQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
RoutingType routingType,
|
||||
|
@ -396,6 +426,7 @@ public interface ServerSession extends SecurityAuth {
|
|||
Long autoDeleteDelay,
|
||||
Long autoDeleteMessageCount) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
void createSharedQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
RoutingType routingType,
|
||||
|
@ -416,17 +447,21 @@ public interface ServerSession extends SecurityAuth {
|
|||
Long autoDeleteDelay,
|
||||
Long autoDeleteMessageCount) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
void createSharedQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
RoutingType routingType,
|
||||
boolean durable,
|
||||
SimpleString filterString) throws Exception;
|
||||
|
||||
@Deprecated
|
||||
void createSharedQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
boolean durable,
|
||||
SimpleString filterString) throws Exception;
|
||||
|
||||
void createSharedQueue(QueueConfiguration queueConfiguration) throws Exception;
|
||||
|
||||
List<MessageReference> getInTXMessagesForConsumer(long consumerId);
|
||||
|
||||
List<MessageReference> getInTxLingerMessages();
|
||||
|
@ -468,6 +503,8 @@ public interface ServerSession extends SecurityAuth {
|
|||
*/
|
||||
AddressInfo getAddressAndRoutingType(AddressInfo addressInfo);
|
||||
|
||||
RoutingType getRoutingTypeFromPrefix(SimpleString address, RoutingType defaultRoutingType);
|
||||
|
||||
/**
|
||||
* Get the canonical (i.e. non-prefixed) address and the corresponding routing-type.
|
||||
*
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
|
@ -264,7 +265,7 @@ public class ClusterConnectionBridge extends BridgeImpl {
|
|||
createPermissiveManagementNotificationToFilter() +
|
||||
")");
|
||||
|
||||
sessionConsumer.createTemporaryQueue(managementNotificationAddress, notifQueueName, filter);
|
||||
sessionConsumer.createQueue(new QueueConfiguration(notifQueueName).setAddress(managementNotificationAddress).setFilterString(filter).setDurable(false).setTemporary(true));
|
||||
|
||||
notifConsumer = sessionConsumer.createConsumer(notifQueueName);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
|
@ -721,7 +722,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
|
|||
} else {
|
||||
// Add binding in storage so the queue will get reloaded on startup and we can find it - it's never
|
||||
// actually routed to at that address though
|
||||
queue = server.createQueue(queueName, RoutingType.MULTICAST, queueName, null, true, false, -1, false, true);
|
||||
queue = server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.MULTICAST).setAutoCreateAddress(true).setMaxConsumers(-1).setPurgeOnNoConsumers(false));
|
||||
}
|
||||
|
||||
// There are a few things that will behave differently when it's an internal queue
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.function.Predicate;
|
|||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueAttributes;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSession;
|
||||
|
@ -290,16 +290,17 @@ public class FederatedAddress extends FederatedAbstract implements ActiveMQServe
|
|||
|
||||
private void createRemoteQueue(ClientSession clientSession, FederatedConsumerKey key) throws ActiveMQException {
|
||||
if (!clientSession.queueQuery(key.getQueueName()).isExists()) {
|
||||
QueueAttributes queueAttributes = new QueueAttributes()
|
||||
.setRoutingType(key.getRoutingType())
|
||||
.setFilterString(key.getQueueFilterString())
|
||||
.setDurable(true)
|
||||
.setAutoDelete(config.getAutoDelete() == null ? true : config.getAutoDelete())
|
||||
.setAutoDeleteDelay(config.getAutoDeleteDelay() == null ? TimeUnit.HOURS.toMillis(1) : config.getAutoDeleteDelay())
|
||||
.setAutoDeleteMessageCount(config.getAutoDeleteMessageCount() == null ? -1 : config.getAutoDeleteMessageCount())
|
||||
.setMaxConsumers(-1)
|
||||
.setPurgeOnNoConsumers(false);
|
||||
clientSession.createQueue(key.getAddress(), key.getQueueName(), false, queueAttributes);
|
||||
clientSession.createQueue(new QueueConfiguration(key.getQueueName())
|
||||
.setAddress(key.getAddress())
|
||||
.setRoutingType(key.getRoutingType())
|
||||
.setFilterString(key.getQueueFilterString())
|
||||
.setDurable(true)
|
||||
.setAutoDelete(config.getAutoDelete() == null ? true : config.getAutoDelete())
|
||||
.setAutoDeleteDelay(config.getAutoDeleteDelay() == null ? TimeUnit.HOURS.toMillis(1) : config.getAutoDeleteDelay())
|
||||
.setAutoDeleteMessageCount(config.getAutoDeleteMessageCount() == null ? -1 : config.getAutoDeleteMessageCount())
|
||||
.setMaxConsumers(-1)
|
||||
.setPurgeOnNoConsumers(false)
|
||||
.setAutoCreated(false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQDeleteAddressException;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
|
||||
|
@ -64,7 +65,6 @@ import org.apache.activemq.artemis.core.config.BridgeConfiguration;
|
|||
import org.apache.activemq.artemis.core.config.Configuration;
|
||||
import org.apache.activemq.artemis.core.config.ConfigurationUtils;
|
||||
import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.DivertConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.FederationConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.HAPolicyConfiguration;
|
||||
|
@ -82,7 +82,6 @@ import org.apache.activemq.artemis.core.journal.JournalLoadInformation;
|
|||
import org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl;
|
||||
import org.apache.activemq.artemis.core.paging.PagingManager;
|
||||
import org.apache.activemq.artemis.core.paging.PagingStoreFactory;
|
||||
import org.apache.activemq.artemis.core.paging.cursor.PageSubscription;
|
||||
import org.apache.activemq.artemis.core.paging.impl.PagingManagerImpl;
|
||||
import org.apache.activemq.artemis.core.paging.impl.PagingStoreFactoryDatabase;
|
||||
import org.apache.activemq.artemis.core.paging.impl.PagingStoreFactoryNIO;
|
||||
|
@ -134,7 +133,6 @@ import org.apache.activemq.artemis.core.server.NodeManager;
|
|||
import org.apache.activemq.artemis.core.server.PostQueueCreationCallback;
|
||||
import org.apache.activemq.artemis.core.server.PostQueueDeletionCallback;
|
||||
import org.apache.activemq.artemis.core.server.Queue;
|
||||
import org.apache.activemq.artemis.core.server.QueueConfig;
|
||||
import org.apache.activemq.artemis.core.server.QueueFactory;
|
||||
import org.apache.activemq.artemis.core.server.QueueQueryResult;
|
||||
import org.apache.activemq.artemis.core.server.SecuritySettingPlugin;
|
||||
|
@ -1753,6 +1751,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return nodeManager == null ? null : nodeManager.getNodeId();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final RoutingType routingType,
|
||||
|
@ -1764,6 +1763,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return createQueue(address, routingType, queueName, filterString, durable, temporary, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), as.isAutoCreateAddresses());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final RoutingType routingType,
|
||||
|
@ -1776,6 +1776,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return createQueue(address, routingType, queueName, filterString, user, durable, temporary, false, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), as.isAutoCreateAddresses());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final RoutingType routingType,
|
||||
|
@ -1789,6 +1790,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return createQueue(address, routingType, queueName, filter, null, durable, temporary, false, maxConsumers, purgeOnNoConsumers, autoCreateAddress);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final RoutingType routingType,
|
||||
|
@ -1813,6 +1815,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return createQueue(address, routingType, queueName, filter, null, durable, temporary, false, false, false, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final RoutingType routingType,
|
||||
|
@ -1838,6 +1841,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return createQueue(address, routingType, queueName, filter, null, durable, temporary, false, false, false, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final RoutingType routingType,
|
||||
|
@ -1864,8 +1868,8 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return createQueue(address, routingType, queueName, filter, null, durable, temporary, false, false, false, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, ringSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(SimpleString address,
|
||||
RoutingType routingType,
|
||||
SimpleString queueName,
|
||||
|
@ -1880,30 +1884,35 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return createQueue(address, routingType, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, purgeOnNoConsumers, autoCreateAddress);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, boolean autoCreateAddress) throws Exception {
|
||||
AddressSettings as = getAddressSettingsRepository().getMatch(addressInfo == null ? queueName.toString() : addressInfo.getName().toString());
|
||||
return createQueue(addressInfo, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, purgeOnNoConsumers, as.isDefaultExclusiveQueue(), as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), as.getDefaultGroupFirstKey(), as.isDefaultLastValueQueue(), as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), isAutoDelete(autoCreated, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), autoCreateAddress, false, as.getDefaultRingSize());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue, boolean autoCreateAddress) throws Exception {
|
||||
AddressSettings as = getAddressSettingsRepository().getMatch(addressInfo == null ? queueName.toString() : addressInfo.getName().toString());
|
||||
return createQueue(addressInfo, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), as.getDefaultGroupFirstKey(), lastValue, as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), isAutoDelete(autoCreated, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), autoCreateAddress, false, as.getDefaultRingSize());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception {
|
||||
AddressSettings as = getAddressSettingsRepository().getMatch(addressInfo == null ? queueName.toString() : addressInfo.getName().toString());
|
||||
return createQueue(addressInfo, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, as.getDefaultGroupFirstKey(), lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, false, as.getDefaultRingSize());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception {
|
||||
AddressSettings as = getAddressSettingsRepository().getMatch(addressInfo == null ? queueName.toString() : addressInfo.getName().toString());
|
||||
return createQueue(addressInfo, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, false, as.getDefaultRingSize());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreateAddress, Long ringSize) throws Exception {
|
||||
return createQueue(addressInfo, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, false, ringSize);
|
||||
|
@ -1913,6 +1922,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return autoCreated ? addressSettings.isAutoDeleteQueues() : addressSettings.isAutoDeleteCreatedQueues();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue,
|
||||
|
@ -1921,6 +1931,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return createQueue(address, routingType, queueName, filter, user, durable, temporary, ignoreIfExists, transientQueue, autoCreated, maxConsumers, purgeOnNoConsumers, as.isDefaultExclusiveQueue(), as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), as.isDefaultLastValueQueue(), as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), isAutoDelete(autoCreated, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), autoCreateAddress);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter,
|
||||
SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue,
|
||||
|
@ -1940,6 +1951,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return createQueue(address, getAddressSettingsRepository().getMatch(address == null ? queueName.toString() : address.toString()).getDefaultQueueRoutingType(), queueName, filterString, durable, temporary);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(final SimpleString address,
|
||||
RoutingType routingType,
|
||||
|
@ -1951,6 +1963,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
createSharedQueue(address, routingType, name, filterString, user, durable, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), as.isDefaultExclusiveQueue(), as.isDefaultLastValueQueue());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(final SimpleString address,
|
||||
RoutingType routingType,
|
||||
|
@ -1966,6 +1979,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
createSharedQueue(address, routingType, name, filterString, user, durable, maxConsumers, purgeOnNoConsumers, exclusive, as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), lastValue, as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), isAutoDelete(false, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(final SimpleString address,
|
||||
RoutingType routingType,
|
||||
|
@ -1990,6 +2004,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
createSharedQueue(address, routingType, name, filterString, user, durable, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, as.getDefaultGroupFirstKey(), lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(final SimpleString address,
|
||||
RoutingType routingType,
|
||||
|
@ -2011,31 +2026,47 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
boolean autoDelete,
|
||||
long autoDeleteDelay,
|
||||
long autoDeleteMessageCount) throws Exception {
|
||||
//force the old contract about address
|
||||
if (address == null) {
|
||||
throw new NullPointerException("address can't be null!");
|
||||
createSharedQueue(new QueueConfiguration(name)
|
||||
.setAddress(address)
|
||||
.setRoutingType(routingType)
|
||||
.setFilterString(filterString)
|
||||
.setUser(user)
|
||||
.setDurable(durable)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setGroupRebalance(groupRebalance)
|
||||
.setGroupBuckets(groupBuckets)
|
||||
.setGroupFirstKey(groupFirstKey)
|
||||
.setLastValue(lastValue)
|
||||
.setLastValueKey(lastValueKey)
|
||||
.setNonDestructive(nonDestructive)
|
||||
.setConsumersBeforeDispatch(consumersBeforeDispatch)
|
||||
.setDelayBeforeDispatch(delayBeforeDispatch)
|
||||
.setAutoDelete(autoDelete)
|
||||
.setAutoDeleteDelay(autoDeleteDelay)
|
||||
.setAutoDeleteMessageCount(autoDeleteMessageCount));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createSharedQueue(final QueueConfiguration queueConfiguration) throws Exception {
|
||||
final Queue queue = createQueue(queueConfiguration
|
||||
.setTemporary(!queueConfiguration.isDurable())
|
||||
.setTransient(!queueConfiguration.isDurable())
|
||||
.setAutoCreated(false)
|
||||
.setAutoCreateAddress(true), true);
|
||||
|
||||
if (!queue.getAddress().equals(queueConfiguration.getAddress())) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.queueSubscriptionBelongsToDifferentAddress(queueConfiguration.getName());
|
||||
}
|
||||
|
||||
if (routingType == null) {
|
||||
AddressInfo addressInfo = getAddressInfo(address);
|
||||
routingType = addressInfo.getRoutingTypes().size() == 1 ? addressInfo.getRoutingType() : getAddressSettingsRepository().getMatch(address.toString()).getDefaultQueueRoutingType();
|
||||
if (routingType == null) {
|
||||
// TODO (mtaylor) throw exception Can not determine routing type info from address
|
||||
}
|
||||
}
|
||||
|
||||
final Queue queue = createQueue(address, routingType, name, filterString, user, durable, !durable, true, !durable, false, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, true);
|
||||
|
||||
if (!queue.getAddress().equals(address)) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.queueSubscriptionBelongsToDifferentAddress(name);
|
||||
}
|
||||
|
||||
if (filterString != null && (queue.getFilter() == null || !queue.getFilter().getFilterString().equals(filterString)) || filterString == null && queue.getFilter() != null) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.queueSubscriptionBelongsToDifferentFilter(name);
|
||||
if (queueConfiguration.getFilterString() != null && (queue.getFilter() == null || !queue.getFilter().getFilterString().equals(queueConfiguration.getFilterString())) || queueConfiguration.getFilterString() == null && queue.getFilter() != null) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.queueSubscriptionBelongsToDifferentFilter(queueConfiguration.getName());
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Transient Queue " + name + " created on address " + name + " with filter=" + filterString);
|
||||
logger.debug("Transient Queue " + queueConfiguration.getName() + " created on address " + queueConfiguration.getName() + " with filter=" + queueConfiguration.getFilterString());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3035,9 +3066,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
.map(CoreAddressConfiguration::getName)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Set<String> queuesInConfig = configuration.getAddressConfigurations().stream()
|
||||
.map(CoreAddressConfiguration::getQueueConfigurations)
|
||||
.flatMap(List::stream).map(CoreQueueConfiguration::getName)
|
||||
Set<SimpleString> queuesInConfig = configuration.getAddressConfigurations().stream()
|
||||
.map(CoreAddressConfiguration::getQueueConfigs)
|
||||
.flatMap(List::stream).map(QueueConfiguration::getName)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
for (SimpleString addressName : listAddressNames()) {
|
||||
|
@ -3062,7 +3093,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
}
|
||||
} else if (addressSettings.getConfigDeleteQueues() == DeletionPolicy.FORCE) {
|
||||
for (Queue queue : listConfiguredQueues(addressName)) {
|
||||
if (!queuesInConfig.contains(queue.getName().toString())) {
|
||||
if (!queuesInConfig.contains(queue.getName())) {
|
||||
ActiveMQServerLogger.LOGGER.undeployQueue(queue.getName());
|
||||
try {
|
||||
queue.deleteQueue(true);
|
||||
|
@ -3107,7 +3138,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
}
|
||||
addOrUpdateAddressInfo(merged);
|
||||
|
||||
deployQueuesFromListCoreQueueConfiguration(config.getQueueConfigurations());
|
||||
deployQueuesFromListQueueConfiguration(config.getQueueConfigs());
|
||||
|
||||
//Now all queues updated we apply the actual address info expected tobe.
|
||||
addOrUpdateAddressInfo(tobe);
|
||||
|
@ -3127,44 +3158,36 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return new AddressInfo(address, mergedRoutingTypes);
|
||||
}
|
||||
|
||||
private void deployQueuesFromListCoreQueueConfiguration(List<CoreQueueConfiguration> queues) throws Exception {
|
||||
for (CoreQueueConfiguration config : queues) {
|
||||
private void deployQueuesFromListQueueConfiguration(List<QueueConfiguration> queues) throws Exception {
|
||||
for (QueueConfiguration config : queues) {
|
||||
try {
|
||||
SimpleString queueName = SimpleString.toSimpleString(config.getName());
|
||||
ActiveMQServerLogger.LOGGER.deployQueue(config.getName(), config.getAddress(), config.getRoutingType().toString());
|
||||
AddressSettings as = addressSettingsRepository.getMatch(config.getAddress());
|
||||
// determine if there is an address::queue match; update it if so
|
||||
int maxConsumers = config.getMaxConsumers() == null ? as.getDefaultMaxConsumers() : config.getMaxConsumers();
|
||||
boolean isExclusive = config.isExclusive() == null ? as.isDefaultExclusiveQueue() : config.isExclusive();
|
||||
boolean groupRebalance = config.isGroupRebalance() == null ? as.isDefaultGroupRebalance() : config.isGroupRebalance();
|
||||
int groupBuckets = config.getGroupBuckets() == null ? as.getDefaultGroupBuckets() : config.getGroupBuckets();
|
||||
SimpleString groupFirstKey = config.getGroupFirstKey() == null ? as.getDefaultGroupFirstKey() : SimpleString.toSimpleString(config.getGroupFirstKey());
|
||||
boolean isLastValue = config.isLastValue() == null ? as.isDefaultLastValueQueue() : config.isLastValue();
|
||||
SimpleString lastValueKey = config.getLastValueKey() == null ? as.getDefaultLastValueKey() : SimpleString.toSimpleString(config.getLastValueKey());
|
||||
boolean isNonDestructive = config.isNonDestructive() == null ? as.isDefaultNonDestructive() : config.isNonDestructive();
|
||||
int consumersBeforeDispatch = config.getConsumersBeforeDispatch() == null ? as.getDefaultConsumersBeforeDispatch() : config.getConsumersBeforeDispatch();
|
||||
long delayBeforeDispatch = config.getDelayBeforeDispatch() == null ? as.getDefaultDelayBeforeDispatch() : config.getDelayBeforeDispatch();
|
||||
long ringSize = config.getRingSize() == null ? as.getDefaultRingSize() : config.getRingSize();
|
||||
QueueConfigurationUtils.applyDynamicQueueDefaults(config, addressSettingsRepository.getMatch(config.getAddress().toString()));
|
||||
|
||||
if (locateQueue(queueName) != null && locateQueue(queueName).getAddress().toString().equals(config.getAddress())) {
|
||||
updateQueue(config.getName(), config.getRoutingType(), config.getFilterString(), maxConsumers, config.getPurgeOnNoConsumers(), isExclusive, groupRebalance, groupBuckets, groupFirstKey != null ? groupFirstKey.toString() : null, isNonDestructive, consumersBeforeDispatch, delayBeforeDispatch, config.getUser(), true, ringSize);
|
||||
config.setAutoCreateAddress(true);
|
||||
|
||||
ActiveMQServerLogger.LOGGER.deployQueue(config.getName().toString(), config.getAddress().toString(), config.getRoutingType().toString());
|
||||
|
||||
// determine if there is an address::queue match; update it if so
|
||||
if (locateQueue(config.getName()) != null && locateQueue(config.getName()).getAddress().equals(config.getAddress())) {
|
||||
updateQueue(config.setConfigurationManaged(true));
|
||||
} else {
|
||||
// if the address::queue doesn't exist then create it
|
||||
try {
|
||||
createQueue(new AddressInfo(SimpleString.toSimpleString(config.getAddress())).addRoutingType(config.getRoutingType()), queueName, SimpleString.toSimpleString(config.getFilterString()), SimpleString.toSimpleString(config.getUser()), config.isDurable(), false, false, false, false, maxConsumers, config.getPurgeOnNoConsumers(), isExclusive, groupRebalance, groupBuckets, groupFirstKey, isLastValue, lastValueKey, isNonDestructive, consumersBeforeDispatch, delayBeforeDispatch, isAutoDelete(false, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), true, true, ringSize);
|
||||
// handful of hard-coded config values for the static configuration use-case
|
||||
createQueue(config.setTemporary(false).setTransient(false).setAutoCreated(false).setConfigurationManaged(true).setAutoCreateAddress(true), false);
|
||||
} catch (ActiveMQQueueExistsException e) {
|
||||
// the queue may exist on a *different* address
|
||||
ActiveMQServerLogger.LOGGER.warn(e.getMessage());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ActiveMQServerLogger.LOGGER.problemDeployingQueue(config.getName(), e.getMessage());
|
||||
ActiveMQServerLogger.LOGGER.problemDeployingQueue(config.getName().toString(), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void deployQueuesFromConfiguration() throws Exception {
|
||||
deployQueuesFromListCoreQueueConfiguration(configuration.getQueueConfigurations());
|
||||
deployQueuesFromListQueueConfiguration(configuration.getQueueConfigs());
|
||||
}
|
||||
|
||||
private void checkForPotentialOOMEInAddressConfiguration() {
|
||||
|
@ -3333,6 +3356,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return postOffice.getAddressInfo(address);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Queue createQueue(final AddressInfo addrInfo,
|
||||
final SimpleString queueName,
|
||||
final SimpleString filterString,
|
||||
|
@ -3359,87 +3383,87 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
final boolean autoCreateAddress,
|
||||
final boolean configurationManaged,
|
||||
final long ringSize) throws Exception {
|
||||
SimpleString realQueueName = CompositeAddress.extractQueueName(queueName);
|
||||
return createQueue(new QueueConfiguration(queueName)
|
||||
.setAddress(addrInfo == null ? null : addrInfo.getName())
|
||||
.setRoutingType(addrInfo == null ? null : addrInfo.getRoutingType())
|
||||
.setFilterString(filterString)
|
||||
.setUser(user)
|
||||
.setDurable(durable)
|
||||
.setTemporary(temporary)
|
||||
.setTransient(transientQueue)
|
||||
.setAutoCreated(autoCreated)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setGroupRebalance(groupRebalance)
|
||||
.setGroupBuckets(groupBuckets)
|
||||
.setGroupFirstKey(groupFirstKey)
|
||||
.setLastValue(lastValue)
|
||||
.setLastValueKey(lastValueKey)
|
||||
.setNonDestructive(nonDestructive)
|
||||
.setConsumersBeforeDispatch(consumersBeforeDispatch)
|
||||
.setDelayBeforeDispatch(delayBeforeDispatch)
|
||||
.setAutoDelete(autoDelete)
|
||||
.setAutoDeleteDelay(autoDeleteDelay)
|
||||
.setAutoDeleteMessageCount(autoDeleteMessageCount)
|
||||
.setAutoCreateAddress(autoCreateAddress)
|
||||
.setConfigurationManaged(configurationManaged)
|
||||
.setRingSize(ringSize),
|
||||
ignoreIfExists);
|
||||
}
|
||||
|
||||
if (realQueueName == null || realQueueName.length() == 0) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.invalidQueueName(queueName);
|
||||
@Override
|
||||
public Queue createQueue(final QueueConfiguration queueConfiguration) throws Exception {
|
||||
return createQueue(queueConfiguration, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Queue createQueue(final QueueConfiguration queueConfiguration, boolean ignoreIfExists) throws Exception {
|
||||
if (queueConfiguration.getName() == null || queueConfiguration.getName().length() == 0) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.invalidQueueName(queueConfiguration.getName());
|
||||
}
|
||||
|
||||
final QueueBinding binding = (QueueBinding) postOffice.getBinding(realQueueName);
|
||||
final QueueBinding binding = (QueueBinding) postOffice.getBinding(queueConfiguration.getName());
|
||||
if (binding != null) {
|
||||
if (ignoreIfExists) {
|
||||
return binding.getQueue();
|
||||
} else {
|
||||
throw ActiveMQMessageBundle.BUNDLE.queueAlreadyExists(realQueueName, binding.getAddress());
|
||||
throw ActiveMQMessageBundle.BUNDLE.queueAlreadyExists(queueConfiguration.getName(), binding.getAddress());
|
||||
}
|
||||
}
|
||||
|
||||
final Filter filter = FilterImpl.createFilter(filterString);
|
||||
QueueConfigurationUtils.applyDynamicQueueDefaults(queueConfiguration, addressSettingsRepository.getMatch(queueConfiguration.getAddress().toString()));
|
||||
|
||||
final long txID = storageManager.generateID();
|
||||
final long queueID = storageManager.generateID();
|
||||
|
||||
final QueueConfig.Builder queueConfigBuilder;
|
||||
|
||||
final SimpleString addressToUse = (addrInfo == null || addrInfo.getName() == null) ? realQueueName : addrInfo.getName();
|
||||
|
||||
queueConfigBuilder = QueueConfig.builderWith(queueID, realQueueName, addressToUse);
|
||||
|
||||
AddressInfo info = postOffice.getAddressInfo(addressToUse);
|
||||
|
||||
RoutingType routingType = addrInfo == null ? null : addrInfo.getRoutingType();
|
||||
RoutingType rt = (routingType == null ? ActiveMQDefaultConfiguration.getDefaultRoutingType() : routingType);
|
||||
if (autoCreateAddress || temporary) {
|
||||
AddressInfo info = postOffice.getAddressInfo(queueConfiguration.getAddress());
|
||||
if (queueConfiguration.isAutoCreateAddress() || queueConfiguration.isTemporary()) {
|
||||
if (info == null) {
|
||||
final AddressInfo addressInfo = new AddressInfo(addressToUse, rt)
|
||||
.setAutoCreated(true)
|
||||
.setTemporary(temporary)
|
||||
.setInternal(addrInfo == null ? false : addrInfo.isInternal());
|
||||
addAddressInfo(addressInfo);
|
||||
} else if (!info.getRoutingTypes().contains(rt)) {
|
||||
addAddressInfo(new AddressInfo(queueConfiguration.getAddress(), queueConfiguration.getRoutingType())
|
||||
.setAutoCreated(true)
|
||||
.setTemporary(queueConfiguration.isTemporary())
|
||||
.setInternal(queueConfiguration.isInternal()));
|
||||
} else if (!info.getRoutingTypes().contains(queueConfiguration.getRoutingType())) {
|
||||
EnumSet<RoutingType> routingTypes = EnumSet.copyOf(info.getRoutingTypes());
|
||||
routingTypes.add(rt);
|
||||
routingTypes.add(queueConfiguration.getRoutingType());
|
||||
updateAddressInfo(info.getName(), routingTypes);
|
||||
}
|
||||
} else if (info == null) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(addressToUse);
|
||||
} else if (!info.getRoutingTypes().contains(rt)) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeForAddress(rt, info.getName().toString(), info.getRoutingTypes());
|
||||
throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(queueConfiguration.getAddress());
|
||||
} else if (!info.getRoutingTypes().contains(queueConfiguration.getRoutingType())) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeForAddress(queueConfiguration.getRoutingType(), info.getName().toString(), info.getRoutingTypes());
|
||||
}
|
||||
|
||||
final QueueConfig queueConfig = queueConfigBuilder
|
||||
.filter(filter)
|
||||
.pagingManager(pagingManager)
|
||||
.user(user)
|
||||
.durable(durable)
|
||||
.temporary(temporary)
|
||||
.autoCreated(autoCreated)
|
||||
.routingType(rt)
|
||||
.maxConsumers(maxConsumers)
|
||||
.purgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.exclusive(exclusive)
|
||||
.groupRebalance(groupRebalance)
|
||||
.groupBuckets(groupBuckets)
|
||||
.groupFirstKey(groupFirstKey)
|
||||
.lastValue(lastValue)
|
||||
.lastValueKey(lastValueKey)
|
||||
.nonDestructive(nonDestructive)
|
||||
.consumersBeforeDispatch(consumersBeforeDispatch)
|
||||
.delayBeforeDispatch(delayBeforeDispatch)
|
||||
.autoDelete(autoDelete)
|
||||
.autoDeleteDelay(autoDeleteDelay)
|
||||
.autoDeleteMessageCount(autoDeleteMessageCount)
|
||||
.configurationManaged(configurationManaged)
|
||||
.ringSize(ringSize)
|
||||
.build();
|
||||
|
||||
if (hasBrokerQueuePlugins()) {
|
||||
callBrokerQueuePlugins(plugin -> plugin.beforeCreateQueue(queueConfig));
|
||||
callBrokerQueuePlugins(plugin -> plugin.beforeCreateQueue(queueConfiguration));
|
||||
}
|
||||
|
||||
final Queue queue = queueFactory.createQueueWith(queueConfig);
|
||||
queueConfiguration.setId(storageManager.generateID());
|
||||
|
||||
if (transientQueue) {
|
||||
// preemptive check to ensure the filterString is good
|
||||
FilterImpl.createFilter(queueConfiguration.getFilterString());
|
||||
|
||||
final Queue queue = queueFactory.createQueueWith(queueConfiguration, pagingManager);
|
||||
|
||||
if (queueConfiguration.isTransient()) {
|
||||
queue.setConsumersRefCount(new TransientQueueManagerImpl(this, queue.getName()));
|
||||
} else {
|
||||
queue.setConsumersRefCount(new QueueManagerImpl(this, queue.getName()));
|
||||
|
@ -3447,7 +3471,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
|
||||
final QueueBinding localQueueBinding = new LocalQueueBinding(queue.getAddress(), queue, nodeManager.getNodeId());
|
||||
|
||||
long txID = 0;
|
||||
if (queue.isDurable()) {
|
||||
txID = storageManager.generateID();
|
||||
storageManager.addQueueBinding(txID, localQueueBinding);
|
||||
}
|
||||
|
||||
|
@ -3458,15 +3484,14 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
if (durable) {
|
||||
if (queueConfiguration.isDurable()) {
|
||||
storageManager.rollbackBindings(txID);
|
||||
}
|
||||
final PageSubscription pageSubscription = queue.getPageSubscription();
|
||||
try {
|
||||
queue.close();
|
||||
} finally {
|
||||
if (pageSubscription != null) {
|
||||
pageSubscription.destroy();
|
||||
if (queue.getPageSubscription() != null) {
|
||||
queue.getPageSubscription().destroy();
|
||||
}
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
|
@ -3475,7 +3500,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
throw e;
|
||||
}
|
||||
|
||||
if (addrInfo == null || !addrInfo.isInternal()) {
|
||||
if (!queueConfiguration.isInternal()) {
|
||||
managementService.registerQueue(queue, queue.getAddress(), storageManager);
|
||||
}
|
||||
|
||||
|
@ -3499,6 +3524,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final RoutingType routingType,
|
||||
|
@ -3528,6 +3554,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return createQueue(new AddressInfo(address).addRoutingType(routingType), queueName, filterString, user, durable, temporary, ignoreIfExists, transientQueue, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, as.getDefaultGroupFirstKey(), lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, false, as.getDefaultRingSize());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final RoutingType routingType,
|
||||
|
@ -3558,6 +3585,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return createQueue(new AddressInfo(address).addRoutingType(routingType), queueName, filterString, user, durable, temporary, ignoreIfExists, transientQueue, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, false, as.getDefaultRingSize());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final RoutingType routingType,
|
||||
|
@ -3618,6 +3646,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return updateQueue(name, routingType, null, maxConsumers, purgeOnNoConsumers, exclusive, null, null, null, null, null, user);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue updateQueue(String name,
|
||||
RoutingType routingType,
|
||||
|
@ -3634,6 +3663,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return updateQueue(name, routingType, filterString, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, null, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, user, null);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue updateQueue(String name,
|
||||
RoutingType routingType,
|
||||
|
@ -3651,6 +3681,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return updateQueue(name, routingType, filterString, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, user, null);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue updateQueue(String name,
|
||||
RoutingType routingType,
|
||||
|
@ -3666,29 +3697,27 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
Long delayBeforeDispatch,
|
||||
String user,
|
||||
Long ringSize) throws Exception {
|
||||
return updateQueue(name, routingType, filterString, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, user, null, ringSize);
|
||||
return updateQueue(new QueueConfiguration(name)
|
||||
.setRoutingType(routingType)
|
||||
.setFilterString(filterString)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setGroupRebalance(groupRebalance)
|
||||
.setGroupBuckets(groupBuckets)
|
||||
.setGroupFirstKey(groupFirstKey)
|
||||
.setNonDestructive(nonDestructive)
|
||||
.setConsumersBeforeDispatch(consumersBeforeDispatch)
|
||||
.setDelayBeforeDispatch(delayBeforeDispatch)
|
||||
.setUser(user)
|
||||
.setRingSize(ringSize));
|
||||
}
|
||||
|
||||
private Queue updateQueue(String name,
|
||||
RoutingType routingType,
|
||||
String filterString,
|
||||
Integer maxConsumers,
|
||||
Boolean purgeOnNoConsumers,
|
||||
Boolean exclusive,
|
||||
Boolean groupRebalance,
|
||||
Integer groupBuckets,
|
||||
String groupFirstKey,
|
||||
Boolean nonDestructive,
|
||||
Integer consumersBeforeDispatch,
|
||||
Long delayBeforeDispatch,
|
||||
String user,
|
||||
Boolean configurationManaged,
|
||||
Long ringSize) throws Exception {
|
||||
final Filter filter = FilterImpl.createFilter(filterString);
|
||||
final QueueBinding queueBinding = this.postOffice.updateQueue(new SimpleString(name), routingType, filter, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, SimpleString.toSimpleString(groupFirstKey), nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, SimpleString.toSimpleString(user), configurationManaged, ringSize);
|
||||
@Override
|
||||
public Queue updateQueue(QueueConfiguration queueConfiguration) throws Exception {
|
||||
final QueueBinding queueBinding = this.postOffice.updateQueue(queueConfiguration);
|
||||
if (queueBinding != null) {
|
||||
final Queue queue = queueBinding.getQueue();
|
||||
return queue;
|
||||
return queueBinding.getQueue();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -3889,7 +3918,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
configuration.setAddressesSettings(config.getAddressesSettings());
|
||||
configuration.setDivertConfigurations(config.getDivertConfigurations());
|
||||
configuration.setAddressConfigurations(config.getAddressConfigurations());
|
||||
configuration.setQueueConfigurations(config.getQueueConfigurations());
|
||||
configuration.setQueueConfigs(config.getQueueConfigs());
|
||||
configurationReloadDeployed.set(false);
|
||||
if (isActive()) {
|
||||
deployReloadableConfigFromConfiguration();
|
||||
|
@ -3915,7 +3944,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
ActiveMQServerLogger.LOGGER.reloadingConfiguration("addresses");
|
||||
undeployAddressesAndQueueNotInConfiguration(configuration);
|
||||
deployAddressesFromConfiguration(configuration);
|
||||
deployQueuesFromListCoreQueueConfiguration(configuration.getQueueConfigurations());
|
||||
deployQueuesFromListQueueConfiguration(configuration.getQueueConfigs());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.function.Consumer;
|
|||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.filter.Filter;
|
||||
|
@ -57,6 +58,7 @@ public class LastValueQueue extends QueueImpl {
|
|||
private final Map<SimpleString, HolderReference> map = new ConcurrentHashMap<>();
|
||||
private final SimpleString lastValueKey;
|
||||
|
||||
@Deprecated
|
||||
public LastValueQueue(final long persistenceID,
|
||||
final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -89,8 +91,52 @@ public class LastValueQueue extends QueueImpl {
|
|||
final ArtemisExecutor executor,
|
||||
final ActiveMQServer server,
|
||||
final QueueFactory factory) {
|
||||
super(persistenceID, address, name, filter, pagingStore, pageSubscription, user, durable, temporary, autoCreated, routingType, maxConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, purgeOnNoConsumers, autoDelete, autoDeleteDelay, autoDeleteMessageCount, configurationManaged, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory);
|
||||
this.lastValueKey = lastValueKey;
|
||||
this(new QueueConfiguration(name)
|
||||
.setId(persistenceID)
|
||||
.setAddress(address)
|
||||
.setFilterString(filter.getFilterString())
|
||||
.setUser(user)
|
||||
.setDurable(durable)
|
||||
.setTemporary(temporary)
|
||||
.setAutoCreated(autoCreated)
|
||||
.setRoutingType(routingType)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setGroupRebalance(groupRebalance)
|
||||
.setGroupBuckets(groupBuckets)
|
||||
.setGroupFirstKey(groupFirstKey)
|
||||
.setNonDestructive(nonDestructive)
|
||||
.setConsumersBeforeDispatch(consumersBeforeDispatch)
|
||||
.setDelayBeforeDispatch(delayBeforeDispatch)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setAutoDelete(autoDelete)
|
||||
.setAutoDeleteDelay(autoDeleteDelay)
|
||||
.setAutoDeleteMessageCount(autoDeleteMessageCount)
|
||||
.setConfigurationManaged(configurationManaged)
|
||||
.setLastValueKey(lastValueKey),
|
||||
pagingStore,
|
||||
pageSubscription,
|
||||
scheduledExecutor,
|
||||
postOffice,
|
||||
storageManager,
|
||||
addressSettingsRepository,
|
||||
executor,
|
||||
server,
|
||||
factory);
|
||||
}
|
||||
|
||||
public LastValueQueue(final QueueConfiguration queueConfiguration,
|
||||
final PagingStore pagingStore,
|
||||
final PageSubscription pageSubscription,
|
||||
final ScheduledExecutorService scheduledExecutor,
|
||||
final PostOffice postOffice,
|
||||
final StorageManager storageManager,
|
||||
final HierarchicalRepository<AddressSettings> addressSettingsRepository,
|
||||
final ArtemisExecutor executor,
|
||||
final ActiveMQServer server,
|
||||
final QueueFactory factory) {
|
||||
super(queueConfiguration, pagingStore, pageSubscription, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory);
|
||||
this.lastValueKey = queueConfiguration.getLastValueKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -165,6 +211,11 @@ public class LastValueQueue extends QueueImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueueConfiguration getQueueConfiguration() {
|
||||
return super.getQueueConfiguration().setLastValue(true);
|
||||
}
|
||||
|
||||
private void replaceLVQMessage(MessageReference ref, HolderReference hr) {
|
||||
MessageReference oldRef = hr.getReference();
|
||||
|
||||
|
|
|
@ -27,9 +27,10 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.config.Configuration;
|
||||
import org.apache.activemq.artemis.core.filter.Filter;
|
||||
import org.apache.activemq.artemis.core.filter.FilterUtils;
|
||||
import org.apache.activemq.artemis.core.filter.impl.FilterImpl;
|
||||
import org.apache.activemq.artemis.core.journal.Journal;
|
||||
|
@ -39,9 +40,9 @@ import org.apache.activemq.artemis.core.paging.PagingStore;
|
|||
import org.apache.activemq.artemis.core.paging.cursor.PageSubscriptionCounter;
|
||||
import org.apache.activemq.artemis.core.paging.impl.Page;
|
||||
import org.apache.activemq.artemis.core.persistence.AddressBindingInfo;
|
||||
import org.apache.activemq.artemis.core.persistence.AddressQueueStatus;
|
||||
import org.apache.activemq.artemis.core.persistence.GroupingInfo;
|
||||
import org.apache.activemq.artemis.core.persistence.QueueBindingInfo;
|
||||
import org.apache.activemq.artemis.core.persistence.AddressQueueStatus;
|
||||
import org.apache.activemq.artemis.core.persistence.StorageManager;
|
||||
import org.apache.activemq.artemis.core.persistence.impl.PageCountPending;
|
||||
import org.apache.activemq.artemis.core.persistence.impl.journal.AddMessageRecord;
|
||||
|
@ -55,9 +56,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
|
|||
import org.apache.activemq.artemis.core.server.MessageReference;
|
||||
import org.apache.activemq.artemis.core.server.NodeManager;
|
||||
import org.apache.activemq.artemis.core.server.Queue;
|
||||
import org.apache.activemq.artemis.core.server.QueueConfig;
|
||||
import org.apache.activemq.artemis.core.server.QueueFactory;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.core.server.group.GroupingHandler;
|
||||
import org.apache.activemq.artemis.core.server.group.impl.GroupBinding;
|
||||
import org.apache.activemq.artemis.core.server.management.ManagementService;
|
||||
|
@ -121,13 +120,9 @@ public class PostOfficeJournalLoader implements JournalLoader {
|
|||
for (final QueueBindingInfo queueBindingInfo : queueBindingInfos) {
|
||||
queueBindingInfosMap.put(queueBindingInfo.getId(), queueBindingInfo);
|
||||
|
||||
final Filter filter = FilterImpl.createFilter(queueBindingInfo.getFilterString());
|
||||
|
||||
final boolean isTopicIdentification = FilterUtils.isTopicIdentification(filter);
|
||||
|
||||
if (postOffice.getBinding(queueBindingInfo.getQueueName()) != null) {
|
||||
|
||||
if (isTopicIdentification) {
|
||||
if (FilterUtils.isTopicIdentification(FilterImpl.createFilter(queueBindingInfo.getFilterString()))) {
|
||||
final long tx = storageManager.generateID();
|
||||
storageManager.deleteQueueBinding(tx, queueBindingInfo.getId());
|
||||
storageManager.commitBindings(tx);
|
||||
|
@ -138,35 +133,34 @@ public class PostOfficeJournalLoader implements JournalLoader {
|
|||
queueBindingInfo.replaceQueueName(newName);
|
||||
}
|
||||
}
|
||||
final QueueConfig.Builder queueConfigBuilder;
|
||||
if (queueBindingInfo.getAddress() == null) {
|
||||
queueConfigBuilder = QueueConfig.builderWith(queueBindingInfo.getId(), queueBindingInfo.getQueueName());
|
||||
} else {
|
||||
queueConfigBuilder = QueueConfig.builderWith(queueBindingInfo.getId(), queueBindingInfo.getQueueName(), queueBindingInfo.getAddress());
|
||||
}
|
||||
queueConfigBuilder.filter(filter).pagingManager(pagingManager)
|
||||
.user(queueBindingInfo.getUser())
|
||||
.durable(true)
|
||||
.temporary(false)
|
||||
.autoCreated(queueBindingInfo.isAutoCreated())
|
||||
.purgeOnNoConsumers(queueBindingInfo.isPurgeOnNoConsumers())
|
||||
.maxConsumers(queueBindingInfo.getMaxConsumers())
|
||||
.exclusive(queueBindingInfo.isExclusive())
|
||||
.groupRebalance(queueBindingInfo.isGroupRebalance())
|
||||
.groupBuckets(queueBindingInfo.getGroupBuckets())
|
||||
.groupFirstKey(queueBindingInfo.getGroupFirstKey())
|
||||
.lastValue(queueBindingInfo.isLastValue())
|
||||
.lastValueKey(queueBindingInfo.getLastValueKey())
|
||||
.nonDestructive(queueBindingInfo.isNonDestructive())
|
||||
.consumersBeforeDispatch(queueBindingInfo.getConsumersBeforeDispatch())
|
||||
.delayBeforeDispatch(queueBindingInfo.getDelayBeforeDispatch())
|
||||
.autoDelete(queueBindingInfo.isAutoDelete())
|
||||
.autoDeleteDelay(queueBindingInfo.getAutoDeleteDelay())
|
||||
.autoDeleteMessageCount(queueBindingInfo.getAutoDeleteMessageCount())
|
||||
.routingType(RoutingType.getType(queueBindingInfo.getRoutingType()))
|
||||
.configurationManaged((queueBindingInfo.isConfigurationManaged()))
|
||||
.ringSize(queueBindingInfo.getRingSize());
|
||||
final Queue queue = queueFactory.createQueueWith(queueConfigBuilder.build());
|
||||
|
||||
final Queue queue = queueFactory.createQueueWith(new QueueConfiguration(queueBindingInfo.getQueueName())
|
||||
.setId(queueBindingInfo.getId())
|
||||
.setAddress(queueBindingInfo.getAddress())
|
||||
.setFilterString(queueBindingInfo.getFilterString())
|
||||
.setUser(queueBindingInfo.getUser())
|
||||
.setDurable(true)
|
||||
.setTemporary(false)
|
||||
.setAutoCreated(queueBindingInfo.isAutoCreated())
|
||||
.setPurgeOnNoConsumers(queueBindingInfo.isPurgeOnNoConsumers())
|
||||
.setMaxConsumers(queueBindingInfo.getMaxConsumers())
|
||||
.setExclusive(queueBindingInfo.isExclusive())
|
||||
.setGroupRebalance(queueBindingInfo.isGroupRebalance())
|
||||
.setGroupBuckets(queueBindingInfo.getGroupBuckets())
|
||||
.setGroupFirstKey(queueBindingInfo.getGroupFirstKey())
|
||||
.setLastValue(queueBindingInfo.isLastValue())
|
||||
.setLastValueKey(queueBindingInfo.getLastValueKey())
|
||||
.setNonDestructive(queueBindingInfo.isNonDestructive())
|
||||
.setConsumersBeforeDispatch(queueBindingInfo.getConsumersBeforeDispatch())
|
||||
.setDelayBeforeDispatch(queueBindingInfo.getDelayBeforeDispatch())
|
||||
.setAutoDelete(queueBindingInfo.isAutoDelete())
|
||||
.setAutoDeleteDelay(queueBindingInfo.getAutoDeleteDelay())
|
||||
.setAutoDeleteMessageCount(queueBindingInfo.getAutoDeleteMessageCount())
|
||||
.setRoutingType(RoutingType.getType(queueBindingInfo.getRoutingType()))
|
||||
.setConfigurationManaged(queueBindingInfo.isConfigurationManaged())
|
||||
.setRingSize(queueBindingInfo.getRingSize()),
|
||||
pagingManager);
|
||||
|
||||
queue.setConsumersRefCount(new QueueManagerImpl(((PostOfficeImpl)postOffice).getServer(), queueBindingInfo.getQueueName()));
|
||||
|
||||
if (queueBindingInfo.getQueueStatusEncodings() != null) {
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apache.activemq.artemis.core.server.impl;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
|
||||
|
||||
public class QueueConfigurationUtils {
|
||||
|
||||
public static void applyDynamicQueueDefaults(QueueConfiguration config, AddressSettings as) {
|
||||
config.setMaxConsumers(config.getMaxConsumers() == null ? as.getDefaultMaxConsumers() : config.getMaxConsumers());
|
||||
config.setExclusive(config.isExclusive() == null ? as.isDefaultExclusiveQueue() : config.isExclusive());
|
||||
config.setGroupRebalance(config.isGroupRebalance() == null ? as.isDefaultGroupRebalance() : config.isGroupRebalance());
|
||||
config.setGroupBuckets(config.getGroupBuckets() == null ? as.getDefaultGroupBuckets() : config.getGroupBuckets());
|
||||
config.setGroupFirstKey(config.getGroupFirstKey() == null ? as.getDefaultGroupFirstKey() : config.getGroupFirstKey());
|
||||
config.setLastValue(config.isLastValue() == null ? as.isDefaultLastValueQueue() : config.isLastValue());
|
||||
config.setLastValueKey(config.getLastValueKey() == null ? as.getDefaultLastValueKey() : config.getLastValueKey());
|
||||
config.setNonDestructive(config.isNonDestructive() == null ? as.isDefaultNonDestructive() : config.isNonDestructive());
|
||||
config.setConsumersBeforeDispatch(config.getConsumersBeforeDispatch() == null ? as.getDefaultConsumersBeforeDispatch() : config.getConsumersBeforeDispatch());
|
||||
config.setDelayBeforeDispatch(config.getDelayBeforeDispatch() == null ? as.getDefaultDelayBeforeDispatch() : config.getDelayBeforeDispatch());
|
||||
config.setRingSize(config.getRingSize() == null ? as.getDefaultRingSize() : config.getRingSize());
|
||||
config.setRoutingType(config.getRoutingType() == null ? as.getDefaultQueueRoutingType() : config.getRoutingType());
|
||||
config.setPurgeOnNoConsumers(config.isPurgeOnNoConsumers() == null ? as.isDefaultPurgeOnNoConsumers() : config.isPurgeOnNoConsumers());
|
||||
config.setAutoCreateAddress(config.isAutoCreateAddress() == null ? as.isAutoCreateAddresses() : config.isAutoCreateAddress());
|
||||
|
||||
// only set the default auto-delete on auto-created queues
|
||||
config.setAutoDelete(config.isAutoDelete() == null ? config.isAutoCreated() && as.isAutoDeleteQueues() : config.isAutoDelete());
|
||||
|
||||
config.setAutoDeleteDelay(config.getAutoDeleteDelay() == null ? as.getAutoDeleteQueuesDelay() : config.getAutoDeleteDelay());
|
||||
config.setAutoDeleteMessageCount(config.getAutoDeleteMessageCount() == null ? as.getAutoDeleteQueuesMessageCount() : config.getAutoDeleteMessageCount());
|
||||
}
|
||||
}
|
|
@ -20,8 +20,12 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||
|
||||
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.filter.Filter;
|
||||
import org.apache.activemq.artemis.core.filter.impl.FilterImpl;
|
||||
import org.apache.activemq.artemis.core.paging.PagingManager;
|
||||
import org.apache.activemq.artemis.core.paging.PagingStore;
|
||||
import org.apache.activemq.artemis.core.paging.cursor.PageSubscription;
|
||||
import org.apache.activemq.artemis.core.persistence.StorageManager;
|
||||
import org.apache.activemq.artemis.core.postoffice.PostOffice;
|
||||
|
@ -71,6 +75,7 @@ public class QueueFactoryImpl implements QueueFactory {
|
|||
this.postOffice = postOffice;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueueWith(final QueueConfig config) {
|
||||
final Queue queue;
|
||||
|
@ -83,6 +88,20 @@ public class QueueFactoryImpl implements QueueFactory {
|
|||
return queue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Queue createQueueWith(final QueueConfiguration config, PagingManager pagingManager) {
|
||||
validateState(config);
|
||||
final Queue queue;
|
||||
PageSubscription pageSubscription = getPageSubscription(config, pagingManager);
|
||||
if (lastValueKey(config) != null) {
|
||||
queue = new LastValueQueue(config.setLastValueKey(lastValueKey(config)), pageSubscription != null ? pageSubscription.getPagingStore() : null, pageSubscription, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executorFactory.getExecutor(), server, this);
|
||||
} else {
|
||||
queue = new QueueImpl(config, pageSubscription != null ? pageSubscription.getPagingStore() : null, pageSubscription, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executorFactory.getExecutor(), server, this);
|
||||
}
|
||||
server.getCriticalAnalyzer().add(queue);
|
||||
return queue;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final long persistenceID,
|
||||
|
@ -112,6 +131,28 @@ public class QueueFactoryImpl implements QueueFactory {
|
|||
return queue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queueRemoved(Queue queue) {
|
||||
server.getCriticalAnalyzer().remove(queue);
|
||||
}
|
||||
|
||||
public static PageSubscription getPageSubscription(QueueConfiguration queueConfiguration, PagingManager pagingManager) {
|
||||
PageSubscription pageSubscription;
|
||||
|
||||
try {
|
||||
PagingStore pageStore = pagingManager.getPageStore(queueConfiguration.getAddress());
|
||||
if (pageStore != null) {
|
||||
pageSubscription = pageStore.getCursorProvider().createSubscription(queueConfiguration.getId(), FilterImpl.createFilter(queueConfiguration.getFilterString()), queueConfiguration.isDurable());
|
||||
} else {
|
||||
pageSubscription = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
||||
return pageSubscription;
|
||||
}
|
||||
|
||||
private static SimpleString lastValueKey(final QueueConfig config) {
|
||||
if (config.lastValueKey() != null && !config.lastValueKey().isEmpty()) {
|
||||
return config.lastValueKey();
|
||||
|
@ -122,6 +163,16 @@ public class QueueFactoryImpl implements QueueFactory {
|
|||
}
|
||||
}
|
||||
|
||||
private static SimpleString lastValueKey(final QueueConfiguration config) {
|
||||
if (config.getLastValueKey() != null && !config.getLastValueKey().isEmpty()) {
|
||||
return config.getLastValueKey();
|
||||
} else if (config.isLastValue()) {
|
||||
return Message.HDR_LAST_VALUE_NAME;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static SimpleString lastValueKey(final AddressSettings addressSettings) {
|
||||
if (addressSettings.getDefaultLastValueKey() != null && !addressSettings.getDefaultLastValueKey().isEmpty()) {
|
||||
return addressSettings.getDefaultLastValueKey();
|
||||
|
@ -132,8 +183,16 @@ public class QueueFactoryImpl implements QueueFactory {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queueRemoved(Queue queue) {
|
||||
server.getCriticalAnalyzer().remove(queue);
|
||||
private void validateState(QueueConfiguration config) {
|
||||
if (isEmptyOrNull(config.getName())) {
|
||||
throw new IllegalStateException("name can't be null or empty!");
|
||||
}
|
||||
if (isEmptyOrNull(config.getAddress())) {
|
||||
throw new IllegalStateException("address can't be null or empty!");
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEmptyOrNull(SimpleString value) {
|
||||
return (value == null || value.length() == 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQNullRefException;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
|
||||
|
@ -55,6 +56,7 @@ import org.apache.activemq.artemis.api.core.management.QueueControl;
|
|||
import org.apache.activemq.artemis.api.core.management.ResourceNames;
|
||||
import org.apache.activemq.artemis.core.PriorityAware;
|
||||
import org.apache.activemq.artemis.core.filter.Filter;
|
||||
import org.apache.activemq.artemis.core.filter.impl.FilterImpl;
|
||||
import org.apache.activemq.artemis.core.io.IOCallback;
|
||||
import org.apache.activemq.artemis.core.paging.PagingStore;
|
||||
import org.apache.activemq.artemis.core.paging.cursor.PageIterator;
|
||||
|
@ -358,6 +360,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
return str.toString();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public QueueImpl(final long id,
|
||||
final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -376,6 +379,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
this(id, address, name, filter, null, null, user, durable, temporary, autoCreated, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public QueueImpl(final long id,
|
||||
final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -396,6 +400,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
this(id, address, name, filter, pagingStore, pageSubscription, user, durable, temporary, autoCreated, RoutingType.MULTICAST, null, null, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public QueueImpl(final long id,
|
||||
final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -419,6 +424,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
this(id, address, name, filter, pagingStore, pageSubscription, user, durable, temporary, autoCreated, routingType, maxConsumers, null, purgeOnNoConsumers, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public QueueImpl(final long id,
|
||||
final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -443,6 +449,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
this(id, address, name, filter, pagingStore, pageSubscription, user, durable, temporary, autoCreated, routingType, maxConsumers, exclusive, null, null, false, null, null, purgeOnNoConsumers, null, null, null, false, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public QueueImpl(final long id,
|
||||
final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -476,6 +483,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
this(id, address, name, filter, pagingStore, pageSubscription, user, durable, temporary, autoCreated, routingType, maxConsumers, exclusive, groupRebalance, groupBuckets, null, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, purgeOnNoConsumers, autoDelete, autoDeleteDelay, autoDeleteMessageCount, configurationManaged, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public QueueImpl(final long id,
|
||||
final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -510,6 +518,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
this(id, address, name, filter, pagingStore, pageSubscription, user, durable, temporary, autoCreated, routingType, maxConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, purgeOnNoConsumers, autoDelete, autoDeleteDelay, autoDeleteMessageCount, configurationManaged, null, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public QueueImpl(final long id,
|
||||
final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -542,57 +551,106 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
final ArtemisExecutor executor,
|
||||
final ActiveMQServer server,
|
||||
final QueueFactory factory) {
|
||||
this(new QueueConfiguration(name)
|
||||
.setId(id)
|
||||
.setAddress(address)
|
||||
.setFilterString(filter == null ? null : filter.getFilterString())
|
||||
.setUser(user)
|
||||
.setDurable(durable)
|
||||
.setTemporary(temporary)
|
||||
.setAutoCreated(autoCreated)
|
||||
.setRoutingType(routingType)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setGroupRebalance(groupRebalance)
|
||||
.setGroupBuckets(groupBuckets)
|
||||
.setGroupFirstKey(groupFirstKey)
|
||||
.setNonDestructive(nonDestructive)
|
||||
.setConsumersBeforeDispatch(consumersBeforeDispatch)
|
||||
.setDelayBeforeDispatch(delayBeforeDispatch)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setAutoDelete(autoDelete)
|
||||
.setAutoDeleteDelay(autoDeleteDelay)
|
||||
.setAutoDeleteMessageCount(autoDeleteMessageCount)
|
||||
.setConfigurationManaged(configurationManaged)
|
||||
.setRingSize(ringSize),
|
||||
pagingStore,
|
||||
pageSubscription,
|
||||
scheduledExecutor,
|
||||
postOffice,
|
||||
storageManager,
|
||||
addressSettingsRepository,
|
||||
executor,
|
||||
server,
|
||||
factory);
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public QueueImpl(final QueueConfiguration queueConfiguration,
|
||||
final PagingStore pagingStore,
|
||||
final PageSubscription pageSubscription,
|
||||
final ScheduledExecutorService scheduledExecutor,
|
||||
final PostOffice postOffice,
|
||||
final StorageManager storageManager,
|
||||
final HierarchicalRepository<AddressSettings> addressSettingsRepository,
|
||||
final ArtemisExecutor executor,
|
||||
final ActiveMQServer server,
|
||||
final QueueFactory factory) {
|
||||
super(server == null ? EmptyCriticalAnalyzer.getInstance() : server.getCriticalAnalyzer(), CRITICAL_PATHS);
|
||||
|
||||
this.id = id;
|
||||
this.id = queueConfiguration.getId();
|
||||
|
||||
this.address = address;
|
||||
this.address = queueConfiguration.getAddress();
|
||||
|
||||
this.addressInfo = postOffice == null ? null : postOffice.getAddressInfo(address);
|
||||
|
||||
this.routingType = routingType;
|
||||
this.routingType = queueConfiguration.getRoutingType();
|
||||
|
||||
this.name = name;
|
||||
this.name = queueConfiguration.getName();
|
||||
|
||||
this.filter = filter;
|
||||
try {
|
||||
this.filter = filter == null ? FilterImpl.createFilter(queueConfiguration.getFilterString()) : filter;
|
||||
} catch (ActiveMQException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
this.pagingStore = pagingStore;
|
||||
|
||||
this.pageSubscription = pageSubscription;
|
||||
|
||||
this.propertyDurable = durable;
|
||||
this.propertyDurable = queueConfiguration.isDurable();
|
||||
|
||||
this.temporary = temporary;
|
||||
this.temporary = queueConfiguration.isTemporary();
|
||||
|
||||
this.autoCreated = autoCreated;
|
||||
this.autoCreated = queueConfiguration.isAutoCreated();
|
||||
|
||||
this.maxConsumers = maxConsumers == null ? ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers() : maxConsumers;
|
||||
this.maxConsumers = queueConfiguration.getMaxConsumers() == null ? ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers() : queueConfiguration.getMaxConsumers();
|
||||
|
||||
this.exclusive = exclusive == null ? ActiveMQDefaultConfiguration.getDefaultExclusive() : exclusive;
|
||||
this.exclusive = queueConfiguration.isExclusive() == null ? ActiveMQDefaultConfiguration.getDefaultExclusive() : queueConfiguration.isExclusive();
|
||||
|
||||
this.nonDestructive = nonDestructive == null ? ActiveMQDefaultConfiguration.getDefaultNonDestructive() : nonDestructive;
|
||||
this.nonDestructive = queueConfiguration.isNonDestructive() == null ? ActiveMQDefaultConfiguration.getDefaultNonDestructive() : queueConfiguration.isNonDestructive();
|
||||
|
||||
this.purgeOnNoConsumers = purgeOnNoConsumers == null ? ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers() : purgeOnNoConsumers;
|
||||
this.purgeOnNoConsumers = queueConfiguration.isPurgeOnNoConsumers() == null ? ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers() : queueConfiguration.isPurgeOnNoConsumers();
|
||||
|
||||
this.consumersBeforeDispatch = consumersBeforeDispatch == null ? ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch() : consumersBeforeDispatch;
|
||||
this.consumersBeforeDispatch = queueConfiguration.getConsumersBeforeDispatch() == null ? ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch() : queueConfiguration.getConsumersBeforeDispatch();
|
||||
|
||||
this.delayBeforeDispatch = delayBeforeDispatch == null ? ActiveMQDefaultConfiguration.getDefaultDelayBeforeDispatch() : delayBeforeDispatch;
|
||||
this.delayBeforeDispatch = queueConfiguration.getDelayBeforeDispatch() == null ? ActiveMQDefaultConfiguration.getDefaultDelayBeforeDispatch() : queueConfiguration.getDelayBeforeDispatch();
|
||||
|
||||
this.groupRebalance = groupRebalance == null ? ActiveMQDefaultConfiguration.getDefaultGroupRebalance() : groupRebalance;
|
||||
this.groupRebalance = queueConfiguration.isGroupRebalance() == null ? ActiveMQDefaultConfiguration.getDefaultGroupRebalance() : queueConfiguration.isGroupRebalance();
|
||||
|
||||
this.groupBuckets = groupBuckets == null ? ActiveMQDefaultConfiguration.getDefaultGroupBuckets() : groupBuckets;
|
||||
this.groupBuckets = queueConfiguration.getGroupBuckets() == null ? ActiveMQDefaultConfiguration.getDefaultGroupBuckets() : queueConfiguration.getGroupBuckets();
|
||||
|
||||
this.groups = groupMap(this.groupBuckets);
|
||||
|
||||
this.groupFirstKey = groupFirstKey == null ? ActiveMQDefaultConfiguration.getDefaultGroupFirstKey() : groupFirstKey;
|
||||
this.groupFirstKey = queueConfiguration.getGroupFirstKey() == null ? ActiveMQDefaultConfiguration.getDefaultGroupFirstKey() : queueConfiguration.getGroupFirstKey();
|
||||
|
||||
this.autoDelete = autoDelete == null ? ActiveMQDefaultConfiguration.getDefaultQueueAutoDelete(autoCreated) : autoDelete;
|
||||
this.autoDelete = queueConfiguration.isAutoDelete() == null ? ActiveMQDefaultConfiguration.getDefaultQueueAutoDelete(autoCreated) : queueConfiguration.isAutoDelete();
|
||||
|
||||
this.autoDeleteDelay = autoDeleteDelay == null ? ActiveMQDefaultConfiguration.getDefaultQueueAutoDeleteDelay() : autoDeleteDelay;
|
||||
this.autoDeleteDelay = queueConfiguration.getAutoDeleteDelay() == null ? ActiveMQDefaultConfiguration.getDefaultQueueAutoDeleteDelay() : queueConfiguration.getAutoDeleteDelay();
|
||||
|
||||
this.autoDeleteMessageCount = autoDeleteMessageCount == null ? ActiveMQDefaultConfiguration.getDefaultQueueAutoDeleteMessageCount() : autoDeleteMessageCount;
|
||||
this.autoDeleteMessageCount = queueConfiguration.getAutoDeleteMessageCount() == null ? ActiveMQDefaultConfiguration.getDefaultQueueAutoDeleteMessageCount() : queueConfiguration.getAutoDeleteMessageCount();
|
||||
|
||||
this.configurationManaged = configurationManaged;
|
||||
this.configurationManaged = queueConfiguration.isConfigurationManaged();
|
||||
|
||||
this.postOffice = postOffice;
|
||||
|
||||
|
@ -622,7 +680,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
|
||||
this.executor = executor;
|
||||
|
||||
this.user = user;
|
||||
this.user = queueConfiguration.getUser();
|
||||
|
||||
this.factory = factory;
|
||||
|
||||
|
@ -631,7 +689,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
this.pause(false);
|
||||
}
|
||||
|
||||
this.ringSize = ringSize == null ? ActiveMQDefaultConfiguration.getDefaultRingSize() : ringSize;
|
||||
this.ringSize = queueConfiguration.getRingSize() == null ? ActiveMQDefaultConfiguration.getDefaultRingSize() : queueConfiguration.getRingSize();
|
||||
}
|
||||
|
||||
// Bindable implementation -------------------------------------------------------------------------------------
|
||||
|
@ -3437,7 +3495,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
if (addressSettings.getDeadLetterAddress() != null && addressSettings.getDeadLetterAddress().length() != 0) {
|
||||
SimpleString dlqName = addressSettings.getDeadLetterQueuePrefix().concat(getAddress()).concat(addressSettings.getDeadLetterQueueSuffix());
|
||||
SimpleString dlqFilter = new SimpleString(String.format("%s = '%s'", Message.HDR_ORIGINAL_ADDRESS, getAddress()));
|
||||
server.createQueue(addressSettings.getDeadLetterAddress(), RoutingType.MULTICAST, dlqName, dlqFilter, null, true, false, true, false, true, addressSettings.getDefaultMaxConsumers(), addressSettings.isDefaultPurgeOnNoConsumers(), addressSettings.isDefaultExclusiveQueue(), addressSettings.isDefaultLastValueQueue(), true);
|
||||
server.createQueue(new QueueConfiguration(dlqName).setAddress(addressSettings.getDeadLetterAddress()).setFilterString(dlqFilter).setAutoCreated(true).setAutoCreateAddress(true), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3448,7 +3506,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
if (addressSettings.getExpiryAddress() != null && addressSettings.getExpiryAddress().length() != 0) {
|
||||
SimpleString expiryQueueName = addressSettings.getExpiryQueuePrefix().concat(getAddress()).concat(addressSettings.getExpiryQueueSuffix());
|
||||
SimpleString expiryFilter = new SimpleString(String.format("%s = '%s'", Message.HDR_ORIGINAL_ADDRESS, getAddress()));
|
||||
server.createQueue(addressSettings.getExpiryAddress(), RoutingType.MULTICAST, expiryQueueName, expiryFilter, null, true, false, true, false, true, addressSettings.getDefaultMaxConsumers(), addressSettings.isDefaultPurgeOnNoConsumers(), addressSettings.isDefaultExclusiveQueue(), addressSettings.isDefaultLastValueQueue(), true);
|
||||
server.createQueue(new QueueConfiguration(expiryQueueName).setAddress(addressSettings.getExpiryAddress()).setFilterString(expiryFilter).setAutoCreated(true).setAutoCreateAddress(true), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3864,6 +3922,37 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueueConfiguration getQueueConfiguration() {
|
||||
return new QueueConfiguration(name)
|
||||
.setAddress(address)
|
||||
.setId(id)
|
||||
.setRoutingType(routingType)
|
||||
.setFilterString(filter.getFilterString())
|
||||
.setDurable(isDurable())
|
||||
.setUser(user)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setGroupRebalance(groupRebalance)
|
||||
.setGroupBuckets(groupBuckets)
|
||||
.setGroupFirstKey(groupFirstKey)
|
||||
.setLastValue(false)
|
||||
.setLastValue(null)
|
||||
.setNonDestructive(nonDestructive)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setConsumersBeforeDispatch(consumersBeforeDispatch)
|
||||
.setDelayBeforeDispatch(delayBeforeDispatch)
|
||||
.setAutoDelete(autoDelete)
|
||||
.setAutoDeleteDelay(autoDeleteDelay)
|
||||
.setAutoDeleteMessageCount(autoDeleteMessageCount)
|
||||
.setRingSize(ringSize)
|
||||
.setConfigurationManaged(configurationManaged)
|
||||
.setTemporary(temporary)
|
||||
.setInternal(internalQueue)
|
||||
.setTransient(refCountForConsumers instanceof TransientQueueManagerImpl)
|
||||
.setAutoCreated(autoCreated);
|
||||
}
|
||||
|
||||
// Inner classes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.TreeSet;
|
|||
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientMessage;
|
||||
|
@ -453,7 +454,7 @@ public class ScaleDownHandler {
|
|||
RoutingType routingType) throws Exception {
|
||||
long queueID = getQueueID(session, queue.getName());
|
||||
if (queueID == -1) {
|
||||
session.createQueue(addressName, routingType, queue.getName(), queue.getFilter() == null ? null : queue.getFilter().getFilterString(), queue.isDurable());
|
||||
session.createQueue(new QueueConfiguration(queue.getName()).setAddress(addressName).setRoutingType(routingType).setFilterString(queue.getFilter() == null ? null : queue.getFilter().getFilterString()).setDurable(queue.isDurable()));
|
||||
logger.debug("Failed to get queue ID, creating queue [addressName=" + addressName + ", queueName=" + queue.getName() + ", routingType=" + queue.getRoutingType() + ", filter=" + (queue.getFilter() == null ? "" : queue.getFilter().getFilterString()) + ", durable=" + queue.isDurable() + "]");
|
||||
queueID = getQueueID(session, queue.getName());
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
|
||||
|
@ -623,6 +624,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
this.autoCommitSends = transaction == null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -633,6 +635,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
return createQueue(address, name, as.getDefaultQueueRoutingType(), filterString, temporary, durable, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), false);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -644,12 +647,14 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
return createQueue(address, name, routingType, filterString, temporary, durable, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), false);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(AddressInfo addressInfo, SimpleString name, SimpleString filterString, boolean temporary, boolean durable) throws Exception {
|
||||
AddressSettings as = server.getAddressSettingsRepository().getMatch(addressInfo.getName().toString());
|
||||
return createQueue(addressInfo, name, filterString, temporary, durable, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), as.isDefaultExclusiveQueue(), as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), as.getDefaultGroupFirstKey(), as.isDefaultLastValueQueue(), as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), ActiveMQServerImpl.isAutoDelete(false, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), false, ActiveMQDefaultConfiguration.getDefaultRingSize());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Queue createQueue(final AddressInfo addressInfo,
|
||||
final SimpleString name,
|
||||
final SimpleString filterString,
|
||||
|
@ -671,40 +676,67 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
final long autoDeleteMessageCount,
|
||||
final boolean autoCreated,
|
||||
final long ringSize) throws Exception {
|
||||
return createQueue(new QueueConfiguration(name)
|
||||
.setAddress(addressInfo.getName())
|
||||
.setRoutingType(addressInfo.getRoutingType())
|
||||
.setFilterString(filterString)
|
||||
.setUser(getUsername())
|
||||
.setDurable(durable)
|
||||
.setTemporary(temporary)
|
||||
.setAutoCreated(autoCreated)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setGroupRebalance(groupRebalance)
|
||||
.setGroupBuckets(groupBuckets)
|
||||
.setGroupFirstKey(groupFirstKey)
|
||||
.setLastValue(lastValue)
|
||||
.setLastValueKey(lastValueKey)
|
||||
.setNonDestructive(nonDestructive)
|
||||
.setConsumersBeforeDispatch(consumersBeforeDispatch)
|
||||
.setDelayBeforeDispatch(delayBeforeDispatch)
|
||||
.setAutoDelete(autoDelete)
|
||||
.setAutoDeleteDelay(autoDeleteDelay)
|
||||
.setAutoDeleteMessageCount(autoDeleteMessageCount)
|
||||
.setRingSize(ringSize));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Queue createQueue(QueueConfiguration queueConfiguration) throws Exception {
|
||||
if (AuditLogger.isEnabled()) {
|
||||
AuditLogger.createQueue(this, getUsername(), addressInfo, name, filterString, temporary, durable, maxConsumers, purgeOnNoConsumers,
|
||||
exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch,
|
||||
delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreated);
|
||||
AuditLogger.createQueue(this, getUsername(), queueConfiguration);
|
||||
}
|
||||
final SimpleString unPrefixedName = removePrefix(name);
|
||||
|
||||
AddressInfo art = getAddressAndRoutingType(addressInfo);
|
||||
queueConfiguration
|
||||
.setRoutingType(getRoutingTypeFromPrefix(queueConfiguration.getAddress(), queueConfiguration.getRoutingType()))
|
||||
.setAddress(removePrefix(queueConfiguration.getAddress()))
|
||||
.setName(removePrefix(queueConfiguration.getName()));
|
||||
|
||||
if (durable) {
|
||||
if (queueConfiguration.isDurable()) {
|
||||
// make sure the user has privileges to create this queue
|
||||
securityCheck(art.getName(), unPrefixedName, CheckType.CREATE_DURABLE_QUEUE, this);
|
||||
securityCheck(queueConfiguration.getAddress(), queueConfiguration.getName(), CheckType.CREATE_DURABLE_QUEUE, this);
|
||||
} else {
|
||||
securityCheck(art.getName(), unPrefixedName, CheckType.CREATE_NON_DURABLE_QUEUE, this);
|
||||
securityCheck(queueConfiguration.getAddress(), queueConfiguration.getName(), CheckType.CREATE_NON_DURABLE_QUEUE, this);
|
||||
}
|
||||
|
||||
AddressSettings as = server.getAddressSettingsRepository().getMatch(art.getName().toString());
|
||||
AddressSettings as = server.getAddressSettingsRepository().getMatch(queueConfiguration.getAddress().toString());
|
||||
|
||||
if (as.isAutoCreateAddresses() && server.getAddressInfo(art.getName()) == null) {
|
||||
securityCheck(art.getName(), unPrefixedName, CheckType.CREATE_ADDRESS, this);
|
||||
if (as.isAutoCreateAddresses() && server.getAddressInfo(queueConfiguration.getAddress()) == null) {
|
||||
securityCheck(queueConfiguration.getAddress(), queueConfiguration.getName(), CheckType.CREATE_ADDRESS, this);
|
||||
}
|
||||
|
||||
server.checkQueueCreationLimit(getUsername());
|
||||
|
||||
Queue queue = server.createQueue(art, unPrefixedName, filterString, SimpleString.toSimpleString(getUsername()), durable, temporary, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, as.isAutoCreateAddresses(), ringSize);
|
||||
Queue queue = server.createQueue(queueConfiguration.setUser(getUsername()));
|
||||
|
||||
if (temporary) {
|
||||
if (queueConfiguration.isTemporary()) {
|
||||
// Temporary queue in core simply means the queue will be deleted if
|
||||
// the remoting connection
|
||||
// dies. It does not mean it will get deleted automatically when the
|
||||
// session is closed.
|
||||
// It is up to the user to delete the queue when finished with it
|
||||
|
||||
TempQueueCleanerUpper cleaner = new TempQueueCleanerUpper(server, unPrefixedName);
|
||||
TempQueueCleanerUpper cleaner = new TempQueueCleanerUpper(server, queueConfiguration.getName());
|
||||
if (remotingConnection instanceof TempQueueObserver) {
|
||||
cleaner.setObserver((TempQueueObserver) remotingConnection);
|
||||
}
|
||||
|
@ -712,18 +744,19 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
remotingConnection.addCloseListener(cleaner);
|
||||
remotingConnection.addFailureListener(cleaner);
|
||||
|
||||
tempQueueCleannerUppers.put(unPrefixedName, cleaner);
|
||||
tempQueueCleannerUppers.put(queueConfiguration.getName(), cleaner);
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Queue " + unPrefixedName + " created on address " + addressInfo.getName() +
|
||||
" with filter=" + filterString + " temporary = " +
|
||||
temporary + " durable=" + durable + " on session user=" + this.username + ", connection=" + this.remotingConnection);
|
||||
logger.debug("Queue " + queueConfiguration.getName() + " created on address " + queueConfiguration.getAddress() +
|
||||
" with filter=" + queueConfiguration.getFilterString() + " temporary = " +
|
||||
queueConfiguration.isTemporary() + " durable=" + queueConfiguration.isDurable() + " on session user=" + this.username + ", connection=" + this.remotingConnection);
|
||||
}
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -738,6 +771,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
return createQueue(new AddressInfo(address, routingType), name, filterString, temporary, durable, maxConsumers, purgeOnNoConsumers, as.isDefaultExclusiveQueue(), as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), as.getDefaultGroupFirstKey(), as.isDefaultLastValueQueue(), as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), ActiveMQServerImpl.isAutoDelete(autoCreated, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), autoCreated, as.getDefaultRingSize());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -753,6 +787,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
return createQueue(address, name, routingType, filterString, temporary, durable, maxConsumers, purgeOnNoConsumers, exclusive, null, null, lastValue, null, null, null, null, null, null, null, autoCreated);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -777,6 +812,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
return createQueue(address, name, routingType, filterString, temporary, durable, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, null, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreated);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -802,6 +838,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
return createQueue(address, name, routingType, filterString, temporary, durable, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, null, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreated, null);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -848,6 +885,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
|
@ -860,12 +898,14 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
return createQueue(address, name, routingType, filterString, temporary, durable, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), autoCreated);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(AddressInfo addressInfo, SimpleString name, SimpleString filterString, boolean temporary, boolean durable, boolean autoCreated) throws Exception {
|
||||
AddressSettings as = server.getAddressSettingsRepository().getMatch(addressInfo.getName().toString());
|
||||
return createQueue(addressInfo, name, filterString, temporary, durable, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), as.isDefaultExclusiveQueue(), as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), as.getDefaultGroupFirstKey(), as.isDefaultLastValueQueue(), as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), ActiveMQServerImpl.isAutoDelete(autoCreated, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), autoCreated, as.getDefaultRingSize());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Queue createQueue(AddressInfo addressInfo, SimpleString name, SimpleString filterString, boolean temporary, boolean durable, Boolean exclusive, Boolean lastValue, boolean autoCreated) throws Exception {
|
||||
AddressSettings as = server.getAddressSettingsRepository().getMatch(addressInfo.getName().toString());
|
||||
|
@ -907,6 +947,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
return server.getAddressInfo(art.getName());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
|
@ -920,6 +961,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
createSharedQueue(address, name, routingType, filterString, durable, maxConsumers, purgeOnNoConsumers, exclusive, null, null, lastValue, null, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
|
@ -942,6 +984,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
createSharedQueue(address, name, routingType, filterString, durable, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, null, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(SimpleString address,
|
||||
SimpleString name,
|
||||
|
@ -962,35 +1005,41 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
Boolean autoDelete,
|
||||
Long autoDeleteDelay,
|
||||
Long autoDeleteMessageCount) throws Exception {
|
||||
if (AuditLogger.isEnabled()) {
|
||||
AuditLogger.createSharedQueue(this, getUsername(), address, name, routingType, filterString, durable, maxConsumers, purgeOnNoConsumers,
|
||||
exclusive, groupRebalance, groupBuckets, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch,
|
||||
delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount);
|
||||
}
|
||||
address = removePrefix(address);
|
||||
createSharedQueue(new QueueConfiguration(name)
|
||||
.setAddress(address)
|
||||
.setFilterString(filterString)
|
||||
.setUser(getUsername())
|
||||
.setDurable(durable)
|
||||
.setMaxConsumers(maxConsumers)
|
||||
.setPurgeOnNoConsumers(purgeOnNoConsumers)
|
||||
.setExclusive(exclusive)
|
||||
.setGroupRebalance(groupRebalance)
|
||||
.setGroupBuckets(groupBuckets)
|
||||
.setLastValue(lastValue)
|
||||
.setLastValueKey(lastValueKey)
|
||||
.setNonDestructive(nonDestructive)
|
||||
.setConsumersBeforeDispatch(consumersBeforeDispatch)
|
||||
.setDelayBeforeDispatch(delayBeforeDispatch)
|
||||
.setAutoDelete(autoDelete)
|
||||
.setAutoDeleteDelay(autoDeleteDelay)
|
||||
.setAutoDeleteMessageCount(autoDeleteMessageCount));
|
||||
}
|
||||
|
||||
securityCheck(address, name, durable ? CheckType.CREATE_DURABLE_QUEUE : CheckType.CREATE_NON_DURABLE_QUEUE, this);
|
||||
@Override
|
||||
public void createSharedQueue(QueueConfiguration queueConfiguration) throws Exception {
|
||||
if (AuditLogger.isEnabled()) {
|
||||
AuditLogger.createSharedQueue(this, getUsername(), queueConfiguration);
|
||||
}
|
||||
queueConfiguration.setAddress(removePrefix(queueConfiguration.getAddress()));
|
||||
|
||||
securityCheck(queueConfiguration.getAddress(), queueConfiguration.getName(), queueConfiguration.isDurable() == null || queueConfiguration.isDurable() ? CheckType.CREATE_DURABLE_QUEUE : CheckType.CREATE_NON_DURABLE_QUEUE, this);
|
||||
|
||||
server.checkQueueCreationLimit(getUsername());
|
||||
|
||||
AddressSettings as = server.getAddressSettingsRepository().getMatch(address.toString());
|
||||
|
||||
server.createSharedQueue(address, routingType, name, filterString, SimpleString.toSimpleString(getUsername()), durable,
|
||||
maxConsumers == null ? as.getDefaultMaxConsumers() : maxConsumers,
|
||||
purgeOnNoConsumers == null ? as.isDefaultPurgeOnNoConsumers() : purgeOnNoConsumers,
|
||||
exclusive == null ? as.isDefaultExclusiveQueue() : exclusive,
|
||||
groupRebalance == null ? as.isDefaultGroupRebalance() : groupRebalance,
|
||||
groupBuckets == null ? as.getDefaultGroupBuckets() : groupBuckets,
|
||||
lastValue == null ? as.isDefaultLastValueQueue() : lastValue,
|
||||
lastValueKey == null ? as.getDefaultLastValueKey() : lastValueKey,
|
||||
nonDestructive == null ? as.isDefaultNonDestructive() : nonDestructive,
|
||||
consumersBeforeDispatch == null ? as.getDefaultConsumersBeforeDispatch() : consumersBeforeDispatch,
|
||||
delayBeforeDispatch == null ? as.getDefaultDelayBeforeDispatch() : delayBeforeDispatch,
|
||||
autoDelete == null ? as.isAutoDeleteCreatedQueues() : autoDelete,
|
||||
autoDeleteDelay == null ? as.getAutoDeleteQueuesDelay() : autoDeleteDelay,
|
||||
autoDeleteMessageCount == null ? as.getAutoDeleteQueuesMessageCount() : autoDeleteMessageCount);
|
||||
server.createSharedQueue(queueConfiguration);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -1001,6 +1050,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
createSharedQueue(address, name, routingType, filterString, durable, null, null, null, null);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void createSharedQueue(final SimpleString address,
|
||||
final SimpleString name,
|
||||
|
@ -2205,6 +2255,18 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
return addressInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoutingType getRoutingTypeFromPrefix(SimpleString address, RoutingType defaultRoutingType) {
|
||||
if (prefixEnabled) {
|
||||
for (Map.Entry<SimpleString, RoutingType> entry : prefixes.entrySet()) {
|
||||
if (address.startsWith(entry.getKey())) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return defaultRoutingType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<SimpleString, EnumSet<RoutingType>> getAddressAndRoutingTypes(SimpleString address,
|
||||
EnumSet<RoutingType> defaultRoutingTypes) {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package org.apache.activemq.artemis.core.server.plugin;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.security.SecurityAuth;
|
||||
import org.apache.activemq.artemis.core.server.Queue;
|
||||
|
@ -38,6 +39,17 @@ public interface ActiveMQServerQueuePlugin extends ActiveMQServerBasePlugin {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Before a queue is created
|
||||
*
|
||||
* @param queueConfig
|
||||
* @throws ActiveMQException
|
||||
*/
|
||||
default void beforeCreateQueue(QueueConfiguration queueConfig) throws ActiveMQException {
|
||||
//by default call the old method for backwards compatibility
|
||||
beforeCreateQueue(QueueConfig.fromQueueConfiguration(queueConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* After a queue has been created
|
||||
*
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Map;
|
|||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.config.BridgeConfiguration;
|
||||
|
@ -31,7 +32,6 @@ import org.apache.activemq.artemis.core.postoffice.RoutingStatus;
|
|||
import org.apache.activemq.artemis.core.security.SecurityAuth;
|
||||
import org.apache.activemq.artemis.core.server.MessageReference;
|
||||
import org.apache.activemq.artemis.core.server.Queue;
|
||||
import org.apache.activemq.artemis.core.server.QueueConfig;
|
||||
import org.apache.activemq.artemis.core.server.RoutingContext;
|
||||
import org.apache.activemq.artemis.core.server.ServerConsumer;
|
||||
import org.apache.activemq.artemis.core.server.ServerSession;
|
||||
|
@ -362,11 +362,10 @@ public class LoggingActiveMQServerPlugin implements ActiveMQServerPlugin, Serial
|
|||
* @throws ActiveMQException
|
||||
*/
|
||||
@Override
|
||||
public void beforeCreateQueue(QueueConfig queueConfig) throws ActiveMQException {
|
||||
public void beforeCreateQueue(QueueConfiguration queueConfig) throws ActiveMQException {
|
||||
if (logAll || logInternalEvents) {
|
||||
LoggingActiveMQServerPluginLogger.LOGGER.beforeCreateQueue(queueConfig);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.core.server.plugin.impl;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.config.BridgeConfiguration;
|
||||
import org.apache.activemq.artemis.core.persistence.OperationContext;
|
||||
|
@ -24,7 +25,6 @@ import org.apache.activemq.artemis.core.postoffice.RoutingStatus;
|
|||
import org.apache.activemq.artemis.core.security.SecurityAuth;
|
||||
import org.apache.activemq.artemis.core.server.MessageReference;
|
||||
import org.apache.activemq.artemis.core.server.Queue;
|
||||
import org.apache.activemq.artemis.core.server.QueueConfig;
|
||||
import org.apache.activemq.artemis.core.server.RoutingContext;
|
||||
import org.apache.activemq.artemis.core.server.ServerConsumer;
|
||||
import org.apache.activemq.artemis.core.server.ServerSession;
|
||||
|
@ -197,7 +197,7 @@ public interface LoggingActiveMQServerPluginLogger extends BasicLogger {
|
|||
|
||||
@LogMessage(level = Logger.Level.DEBUG)
|
||||
@Message(id = 843006, value = "beforeCreateQueue called with queueConfig: {0}", format = Message.Format.MESSAGE_FORMAT)
|
||||
void beforeCreateQueue(QueueConfig queueConfig);
|
||||
void beforeCreateQueue(QueueConfiguration queueConfig);
|
||||
|
||||
@LogMessage(level = Logger.Level.DEBUG)
|
||||
@Message(id = 843007, value = "beforeDestroyQueue called with queueName: {0}, session: {1}, checkConsumerCount: {2}," +
|
||||
|
|
|
@ -62,7 +62,7 @@ public class DefaultsFileConfigurationTest extends ConfigurationImplTest {
|
|||
|
||||
Assert.assertEquals(Collections.emptyList(), conf.getClusterConfigurations());
|
||||
|
||||
Assert.assertEquals(Collections.emptyList(), conf.getQueueConfigurations());
|
||||
Assert.assertEquals(Collections.emptyList(), conf.getQueueConfigs());
|
||||
|
||||
Assert.assertEquals(Collections.emptyList(), conf.getAddressConfigurations());
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.Set;
|
|||
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
|
@ -39,7 +40,6 @@ import org.apache.activemq.artemis.core.config.BridgeConfiguration;
|
|||
import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.Configuration;
|
||||
import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.DivertConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.FileDeploymentManager;
|
||||
import org.apache.activemq.artemis.core.config.HAPolicyConfiguration;
|
||||
|
@ -405,17 +405,17 @@ public class FileConfigurationTest extends ConfigurationImplTest {
|
|||
assertEquals(104, conf.getResourceLimitSettings().get("myUser").getMaxConnections());
|
||||
assertEquals(13, conf.getResourceLimitSettings().get("myUser").getMaxQueues());
|
||||
|
||||
assertEquals(2, conf.getQueueConfigurations().size());
|
||||
assertEquals(2, conf.getQueueConfigs().size());
|
||||
|
||||
assertEquals("queue1", conf.getQueueConfigurations().get(0).getName());
|
||||
assertEquals("address1", conf.getQueueConfigurations().get(0).getAddress());
|
||||
assertEquals("color='red'", conf.getQueueConfigurations().get(0).getFilterString());
|
||||
assertEquals(false, conf.getQueueConfigurations().get(0).isDurable());
|
||||
assertEquals("queue1", conf.getQueueConfigs().get(0).getName().toString());
|
||||
assertEquals("address1", conf.getQueueConfigs().get(0).getAddress().toString());
|
||||
assertEquals("color='red'", conf.getQueueConfigs().get(0).getFilterString().toString());
|
||||
assertEquals(false, conf.getQueueConfigs().get(0).isDurable());
|
||||
|
||||
assertEquals("queue2", conf.getQueueConfigurations().get(1).getName());
|
||||
assertEquals("address2", conf.getQueueConfigurations().get(1).getAddress());
|
||||
assertEquals("color='blue'", conf.getQueueConfigurations().get(1).getFilterString());
|
||||
assertEquals(false, conf.getQueueConfigurations().get(1).isDurable());
|
||||
assertEquals("queue2", conf.getQueueConfigs().get(1).getName().toString());
|
||||
assertEquals("address2", conf.getQueueConfigs().get(1).getAddress().toString());
|
||||
assertEquals("color='blue'", conf.getQueueConfigs().get(1).getFilterString().toString());
|
||||
assertEquals(false, conf.getQueueConfigs().get(1).isDurable());
|
||||
|
||||
verifyAddresses();
|
||||
|
||||
|
@ -474,30 +474,30 @@ public class FileConfigurationTest extends ConfigurationImplTest {
|
|||
Set<RoutingType> routingTypes = new HashSet<>();
|
||||
routingTypes.add(RoutingType.ANYCAST);
|
||||
assertEquals(routingTypes, addressConfiguration.getRoutingTypes());
|
||||
assertEquals(2, addressConfiguration.getQueueConfigurations().size());
|
||||
assertEquals(2, addressConfiguration.getQueueConfigs().size());
|
||||
|
||||
// Addr 1 Queue 1
|
||||
CoreQueueConfiguration queueConfiguration = addressConfiguration.getQueueConfigurations().get(0);
|
||||
QueueConfiguration queueConfiguration = addressConfiguration.getQueueConfigs().get(0);
|
||||
|
||||
assertEquals("q1", queueConfiguration.getName());
|
||||
assertEquals("q1", queueConfiguration.getName().toString());
|
||||
assertEquals(3L, queueConfiguration.getRingSize().longValue());
|
||||
assertFalse(queueConfiguration.isDurable());
|
||||
assertEquals("color='blue'", queueConfiguration.getFilterString());
|
||||
assertEquals(ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), queueConfiguration.getPurgeOnNoConsumers());
|
||||
assertEquals("addr1", queueConfiguration.getAddress());
|
||||
assertEquals("color='blue'", queueConfiguration.getFilterString().toString());
|
||||
assertEquals(ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), queueConfiguration.isPurgeOnNoConsumers());
|
||||
assertEquals("addr1", queueConfiguration.getAddress().toString());
|
||||
// If null, then default will be taken from address-settings (which defaults to ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers())
|
||||
assertEquals(null, queueConfiguration.getMaxConsumers());
|
||||
|
||||
// Addr 1 Queue 2
|
||||
queueConfiguration = addressConfiguration.getQueueConfigurations().get(1);
|
||||
queueConfiguration = addressConfiguration.getQueueConfigs().get(1);
|
||||
|
||||
assertEquals("q2", queueConfiguration.getName());
|
||||
assertEquals("q2", queueConfiguration.getName().toString());
|
||||
assertEquals(-1, queueConfiguration.getRingSize().longValue());
|
||||
assertTrue(queueConfiguration.isDurable());
|
||||
assertEquals("color='green'", queueConfiguration.getFilterString());
|
||||
assertEquals("color='green'", queueConfiguration.getFilterString().toString());
|
||||
assertEquals(Queue.MAX_CONSUMERS_UNLIMITED, queueConfiguration.getMaxConsumers().intValue());
|
||||
assertFalse(queueConfiguration.getPurgeOnNoConsumers());
|
||||
assertEquals("addr1", queueConfiguration.getAddress());
|
||||
assertFalse(queueConfiguration.isPurgeOnNoConsumers());
|
||||
assertEquals("addr1", queueConfiguration.getAddress().toString());
|
||||
|
||||
// Addr 2
|
||||
addressConfiguration = conf.getAddressConfigurations().get(1);
|
||||
|
@ -505,28 +505,28 @@ public class FileConfigurationTest extends ConfigurationImplTest {
|
|||
routingTypes = new HashSet<>();
|
||||
routingTypes.add(RoutingType.MULTICAST);
|
||||
assertEquals(routingTypes, addressConfiguration.getRoutingTypes());
|
||||
assertEquals(2, addressConfiguration.getQueueConfigurations().size());
|
||||
assertEquals(2, addressConfiguration.getQueueConfigs().size());
|
||||
|
||||
// Addr 2 Queue 1
|
||||
queueConfiguration = addressConfiguration.getQueueConfigurations().get(0);
|
||||
queueConfiguration = addressConfiguration.getQueueConfigs().get(0);
|
||||
|
||||
assertEquals("q3", queueConfiguration.getName());
|
||||
assertEquals("q3", queueConfiguration.getName().toString());
|
||||
assertTrue(queueConfiguration.isDurable());
|
||||
assertEquals("color='red'", queueConfiguration.getFilterString());
|
||||
assertEquals("color='red'", queueConfiguration.getFilterString().toString());
|
||||
assertEquals(10, queueConfiguration.getMaxConsumers().intValue());
|
||||
assertEquals(ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), queueConfiguration.getPurgeOnNoConsumers());
|
||||
assertEquals("addr2", queueConfiguration.getAddress());
|
||||
assertEquals(ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), queueConfiguration.isPurgeOnNoConsumers());
|
||||
assertEquals("addr2", queueConfiguration.getAddress().toString());
|
||||
|
||||
// Addr 2 Queue 2
|
||||
queueConfiguration = addressConfiguration.getQueueConfigurations().get(1);
|
||||
queueConfiguration = addressConfiguration.getQueueConfigs().get(1);
|
||||
|
||||
assertEquals("q4", queueConfiguration.getName());
|
||||
assertEquals("q4", queueConfiguration.getName().toString());
|
||||
assertTrue(queueConfiguration.isDurable());
|
||||
assertNull(queueConfiguration.getFilterString());
|
||||
// If null, then default will be taken from address-settings (which defaults to ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers())
|
||||
assertEquals(null, queueConfiguration.getMaxConsumers());
|
||||
assertTrue(queueConfiguration.getPurgeOnNoConsumers());
|
||||
assertEquals("addr2", queueConfiguration.getAddress());
|
||||
assertTrue(queueConfiguration.isPurgeOnNoConsumers());
|
||||
assertEquals("addr2", queueConfiguration.getAddress().toString());
|
||||
|
||||
// Addr 3
|
||||
addressConfiguration = conf.getAddressConfigurations().get(2);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.core.message.impl;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientMessage;
|
||||
|
@ -54,7 +55,7 @@ public class MessagePropertyTest extends ActiveMQTestBase {
|
|||
|
||||
String filter = null;
|
||||
session.createAddress(SimpleString.toSimpleString(ADDRESS), RoutingType.MULTICAST, false);
|
||||
session.createQueue(ADDRESS, RoutingType.MULTICAST, ADDRESS, filter, true);
|
||||
session.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.MULTICAST).setFilterString(filter));
|
||||
ClientProducer producer = session.createProducer(ADDRESS);
|
||||
|
||||
for (int i = 0; i < numMessages; i++) {
|
||||
|
|
|
@ -66,6 +66,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
|
|||
import org.apache.activemq.artemis.api.core.ICoreMessage;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.Pair;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
|
||||
|
@ -1580,7 +1581,7 @@ public abstract class ActiveMQTestBase extends Assert {
|
|||
ClientSessionFactory sf = locator.createSessionFactory();
|
||||
ClientSession session = sf.createSession();
|
||||
try {
|
||||
session.createQueue(address, queue);
|
||||
session.createQueue(new QueueConfiguration(queue).setAddress(address));
|
||||
} finally {
|
||||
session.close();
|
||||
closeSessionFactory(sf);
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
|
@ -254,7 +255,7 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
|
|||
if (coreQ == null) {
|
||||
coreQ = new SimpleString(qname);
|
||||
try {
|
||||
this.server.createQueue(coreQ, RoutingType.MULTICAST, coreQ, null, false, false);
|
||||
this.server.createQueue(new QueueConfiguration(coreQ).setDurable(false));
|
||||
testQueues.put(qname, coreQ);
|
||||
} catch (ActiveMQQueueExistsException e) {
|
||||
//ignore
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.concurrent.Executors;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.JsonUtil;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
|
@ -139,7 +140,7 @@ public class ActiveMQServerControlMultiThreadTest extends ManagementTestBase {
|
|||
ActiveMQServerControl serverControl = createManagementControl();
|
||||
|
||||
server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST));
|
||||
server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false);
|
||||
server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST).setDurable(false));
|
||||
|
||||
// create a consumer
|
||||
try (ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator);
|
||||
|
|
|
@ -23,6 +23,7 @@ import javax.transaction.xa.Xid;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQTransactionOutcomeUnknownException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQTransactionRolledBackException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQUnBlockedException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
|
@ -101,7 +102,7 @@ public class BMFailoverTest extends FailoverTestBase {
|
|||
|
||||
ClientSession session = createSession(sf, true, false, false);
|
||||
|
||||
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
|
||||
session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS));
|
||||
|
||||
ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
|
||||
|
||||
|
@ -175,8 +176,8 @@ public class BMFailoverTest extends FailoverTestBase {
|
|||
// closeable will take care of closing it
|
||||
try (ClientSession session = sf.createSession(false, true, true);
|
||||
ClientProducer sendInitialProducer = session.createProducer();) {
|
||||
session.createQueue(inQueue, inQueue, null, true);
|
||||
session.createQueue(outQueue, outQueue, null, true);
|
||||
session.createQueue(new QueueConfiguration(inQueue));
|
||||
session.createQueue(new QueueConfiguration(outQueue));
|
||||
sendInitialProducer.send(inQueue, createMessage(session, 0, true));
|
||||
}
|
||||
|
||||
|
@ -325,14 +326,14 @@ public class BMFailoverTest extends FailoverTestBase {
|
|||
private ClientSession createSessionAndQueue() throws Exception {
|
||||
ClientSession session = createSession(sf, false, false);
|
||||
|
||||
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
|
||||
session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS));
|
||||
return session;
|
||||
}
|
||||
|
||||
private ClientSession createXASessionAndQueue() throws Exception {
|
||||
ClientSession session = addClientSession(sf.createSession(true, true, true));
|
||||
|
||||
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
|
||||
session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS));
|
||||
return session;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.BridgeConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
|
||||
import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
||||
import org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl;
|
||||
|
@ -94,15 +94,9 @@ public class BridgeServerLocatorConfigurationTest extends ActiveMQTestBase {
|
|||
bridgeConfigs.add(bridgeConfiguration);
|
||||
serverWithBridge.getConfiguration().setBridgeConfigurations(bridgeConfigs);
|
||||
|
||||
CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0);
|
||||
List<CoreQueueConfiguration> queueConfigs0 = new ArrayList<>();
|
||||
queueConfigs0.add(queueConfig0);
|
||||
serverWithBridge.getConfiguration().setQueueConfigurations(queueConfigs0);
|
||||
serverWithBridge.getConfiguration().addQueueConfiguration(new QueueConfiguration(queueName0).setAddress(testAddress));
|
||||
|
||||
CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1);
|
||||
List<CoreQueueConfiguration> queueConfigs1 = new ArrayList<>();
|
||||
queueConfigs1.add(queueConfig1);
|
||||
server1.getConfiguration().setQueueConfigurations(queueConfigs1);
|
||||
server1.getConfiguration().addQueueConfiguration(new QueueConfiguration(queueName1).setAddress(forwardAddress));
|
||||
|
||||
server1.start();
|
||||
waitForServerToStart(server1);
|
||||
|
|
|
@ -22,6 +22,7 @@ import javax.jms.MessageProducer;
|
|||
import javax.jms.Queue;
|
||||
import javax.jms.Session;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.config.Configuration;
|
||||
|
@ -52,7 +53,7 @@ public class CriticalAnalyzerFaultInjectionTest extends JMSTestBase {
|
|||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST));
|
||||
server.createQueue(address, RoutingType.ANYCAST, address, null, true, false);
|
||||
server.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST));
|
||||
conn = nettyCf.createConnection();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.io.ByteArrayInputStream;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
|
@ -52,7 +52,7 @@ public class LargeMessageOnShutdownTest extends ActiveMQTestBase {
|
|||
|
||||
server = createServer(true, createDefaultNettyConfig());
|
||||
startServer();
|
||||
server.createQueue(queueName, RoutingType.MULTICAST, queueName, null, true, false);
|
||||
server.createQueue(new QueueConfiguration(queueName));
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
|
@ -16,7 +16,15 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.tests.extras.byteman;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
|
||||
|
@ -28,7 +36,6 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator;
|
|||
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal;
|
||||
import org.apache.activemq.artemis.core.config.Configuration;
|
||||
import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.DivertConfiguration;
|
||||
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
|
||||
import org.apache.activemq.artemis.tests.integration.cluster.failover.FailoverTestBase;
|
||||
|
@ -39,13 +46,6 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
@RunWith(BMUnitRunner.class)
|
||||
public class LargeMessageReplicationTest extends FailoverTestBase {
|
||||
|
||||
|
@ -94,10 +94,7 @@ public class LargeMessageReplicationTest extends FailoverTestBase {
|
|||
CoreAddressConfiguration addrCfg = new CoreAddressConfiguration();
|
||||
addrCfg.setName(address);
|
||||
addrCfg.addRoutingType(RoutingType.ANYCAST);
|
||||
CoreQueueConfiguration qConfig = new CoreQueueConfiguration();
|
||||
qConfig.setName(name);
|
||||
qConfig.setAddress(address);
|
||||
addrCfg.addQueueConfiguration(qConfig);
|
||||
addrCfg.addQueueConfiguration(new QueueConfiguration(name).setAddress(address));
|
||||
addrConfigs.add(addrCfg);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,15 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.tests.extras.byteman;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.RuntimeMBeanException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
||||
import org.jboss.byteman.contrib.bmunit.BMRule;
|
||||
|
@ -27,12 +35,6 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.RuntimeMBeanException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.HashMap;
|
||||
|
||||
@RunWith(BMUnitRunner.class)
|
||||
public class ManagementExceptionHandlingTest extends ActiveMQTestBase {
|
||||
|
||||
|
@ -67,7 +69,7 @@ public class ManagementExceptionHandlingTest extends ActiveMQTestBase {
|
|||
action = "throw new org.apache.activemq.artemis.api.core.ActiveMQException(\"gotcha\")")})
|
||||
public void testActiveMQServerControl() throws Exception {
|
||||
try {
|
||||
server.getActiveMQServerControl().createQueue("some.address", "ANYCAST", "some.queue", "filter", true, -1, false, true);
|
||||
server.getActiveMQServerControl().createQueue(new QueueConfiguration("some.queue").setAddress("some.address").setRoutingType(RoutingType.ANYCAST).toJSON());
|
||||
fail("test should have gotten an exception!");
|
||||
} catch (ActiveMQException e) {
|
||||
fail("Wrong exception got!");
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.tests.extras.byteman;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientMessage;
|
||||
|
@ -165,8 +166,8 @@ public class OrphanedConsumerTest extends ActiveMQTestBase {
|
|||
|
||||
ClientSession session = sf.createSession(true, true, 0);
|
||||
|
||||
session.createQueue("queue", "queue1", true);
|
||||
session.createQueue("queue", "queue2", true);
|
||||
session.createQueue(new QueueConfiguration("queue1").setAddress("queue"));
|
||||
session.createQueue(new QueueConfiguration("queue2").setAddress("queue"));
|
||||
|
||||
ClientProducer prod = session.createProducer("queue");
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientMessage;
|
||||
|
@ -31,7 +32,6 @@ import org.apache.activemq.artemis.core.config.Configuration;
|
|||
import org.apache.activemq.artemis.core.paging.cursor.impl.PagePositionImpl;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQServers;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
|
||||
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
|
||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
||||
|
@ -132,7 +132,7 @@ public class PagingLeakTest extends ActiveMQTestBase {
|
|||
final int maxConsumed;
|
||||
|
||||
Consumer(int sleepTime, String suffix, int maxConsumed) throws Exception {
|
||||
server.createQueue(address, RoutingType.MULTICAST, address.concat(suffix), null, true, false);
|
||||
server.createQueue(new QueueConfiguration(address.concat(suffix)).setAddress(address));
|
||||
|
||||
this.sleepTime = sleepTime;
|
||||
locator = createInVMLocator(0);
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.nio.ByteBuffer;
|
|||
import java.util.HashMap;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientMessage;
|
||||
|
@ -109,7 +110,7 @@ public class PagingOMETest extends ActiveMQTestBase {
|
|||
|
||||
ClientSession session = sf.createSession(false, false, false);
|
||||
|
||||
session.createQueue(ADDRESS, ADDRESS, null, true);
|
||||
session.createQueue(new QueueConfiguration(ADDRESS));
|
||||
|
||||
Queue queue = server.locateQueue(ADDRESS);
|
||||
queue.getPageSubscription().getPagingStore().startPaging();
|
||||
|
|
|
@ -18,9 +18,9 @@ package org.apache.activemq.artemis.tests.extras.byteman;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
||||
import org.jboss.byteman.contrib.bmunit.BMRule;
|
||||
|
@ -40,7 +40,7 @@ public class QueueDeploymentFailedTest extends ActiveMQTestBase {
|
|||
public void testQueueDeploymentFailure() throws Exception {
|
||||
ActiveMQServer server = createServer(false, createDefaultNettyConfig());
|
||||
String address = UUID.randomUUID().toString();
|
||||
server.getConfiguration().addAddressConfiguration(new CoreAddressConfiguration().setName(address).addRoutingType(RoutingType.ANYCAST).addQueueConfiguration(new CoreQueueConfiguration().setName(UUID.randomUUID().toString()).setRoutingType(RoutingType.ANYCAST).setAddress(address)));
|
||||
server.getConfiguration().addAddressConfiguration(new CoreAddressConfiguration().setName(address).addRoutingType(RoutingType.ANYCAST).addQueueConfiguration(new QueueConfiguration(UUID.randomUUID().toString()).setRoutingType(RoutingType.ANYCAST).setAddress(address)));
|
||||
server.start();
|
||||
assertTrue(server.getRemotingService().isStarted());
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.activemq.artemis.tests.extras.byteman;
|
|||
import java.util.Set;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
|
@ -66,7 +67,7 @@ public class RaceOnClosingConsumerWhileReconnecting extends ActiveMQTestBase {
|
|||
SimpleString addressName1 = new SimpleString("my_address_one");
|
||||
|
||||
server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST));
|
||||
server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, true, false);
|
||||
server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST));
|
||||
|
||||
final long retryInterval = 500;
|
||||
final double retryMultiplier = 1d;
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.HashMap;
|
|||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSession;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
|
||||
|
@ -103,7 +104,7 @@ public class RaceOnCursorIteratorTest extends ActiveMQTestBase {
|
|||
|
||||
session = sf.createSession(false, true, true);
|
||||
|
||||
session.createQueue(ADDRESS, ADDRESS, null, true);
|
||||
session.createQueue(new QueueConfiguration(ADDRESS));
|
||||
|
||||
queue = server.locateQueue(ADDRESS);
|
||||
queue.getPageSubscription().getPagingStore().startPaging();
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSession;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
|
||||
|
@ -64,7 +65,7 @@ public class StompInternalStateTest extends ActiveMQTestBase {
|
|||
ServerLocator locator = createNettyNonHALocator();
|
||||
ClientSessionFactory factory = createSessionFactory(locator);
|
||||
session = factory.createSession();
|
||||
session.createTemporaryQueue(STOMP_QUEUE_NAME, STOMP_QUEUE_NAME);
|
||||
session.createQueue(new QueueConfiguration(STOMP_QUEUE_NAME).setDurable(false).setTemporary(true));
|
||||
session.deleteQueue(STOMP_QUEUE_NAME);
|
||||
|
||||
assertNull(resultTestStompProtocolManagerLeak);
|
||||
|
|
|
@ -29,9 +29,10 @@ import javax.transaction.xa.Xid;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
||||
import org.jboss.byteman.contrib.bmunit.BMRule;
|
||||
|
@ -56,7 +57,7 @@ public class TimeoutXATest extends ActiveMQTestBase {
|
|||
server.getConfiguration().setTransactionTimeoutScanPeriod(1100);
|
||||
server.getConfiguration().setJournalSyncNonTransactional(false);
|
||||
server.start();
|
||||
server.createQueue(SimpleString.toSimpleString("Queue1"), RoutingType.ANYCAST, SimpleString.toSimpleString("Queue1"), null, true, false);
|
||||
server.createQueue(new QueueConfiguration("Queue1").setRoutingType(RoutingType.ANYCAST));
|
||||
|
||||
removingTXEntered0 = new CountDownLatch(1);
|
||||
removingTXAwait0 = new CountDownLatch(1);
|
||||
|
|
|
@ -21,6 +21,7 @@ import javax.jms.MessageProducer;
|
|||
import javax.jms.Queue;
|
||||
import javax.jms.Session;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.config.Configuration;
|
||||
|
@ -46,7 +47,7 @@ public abstract class CriticalAnalyzerFaultInjectionTestBase extends JMSTestBase
|
|||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST));
|
||||
server.createQueue(address, RoutingType.ANYCAST, address, null, true, false);
|
||||
server.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST));
|
||||
conn = nettyCf.createConnection();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ import java.util.Set;
|
|||
import com.arjuna.ats.arjuna.coordinator.TransactionReaper;
|
||||
import com.arjuna.ats.arjuna.coordinator.TxControl;
|
||||
import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.management.AddressControl;
|
||||
import org.apache.activemq.artemis.api.core.management.QueueControl;
|
||||
|
@ -125,7 +125,7 @@ public abstract class BridgeTestBase extends ActiveMQTestBase {
|
|||
if (index == 1) {
|
||||
server = server1;
|
||||
}
|
||||
assertTrue("queue '/queue/" + queueName + "' created", server.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), null, true, false) != null);
|
||||
assertTrue("queue '/queue/" + queueName + "' created", server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)) != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,8 +27,8 @@ import java.util.concurrent.TimeUnit;
|
|||
import com.arjuna.ats.arjuna.coordinator.TransactionReaper;
|
||||
import com.arjuna.ats.arjuna.coordinator.TxControl;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
|
@ -173,7 +173,7 @@ public abstract class ClusteredBridgeTestBase extends ActiveMQTestBase {
|
|||
}
|
||||
|
||||
public void createQueue(String queueName) throws Exception {
|
||||
liveNode.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), null, true, false);
|
||||
liveNode.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST));
|
||||
}
|
||||
|
||||
public ConnectionFactoryFactory getConnectionFactoryFactory() {
|
||||
|
|
|
@ -23,6 +23,7 @@ import javax.transaction.xa.Xid;
|
|||
import org.apache.activemq.artemis.api.core.ActiveMQDuplicateIdException;
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
import org.apache.activemq.artemis.api.core.Message;
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
|
||||
|
@ -61,7 +62,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -167,11 +168,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
for (int i = 0; i < TEST_SIZE; i++) {
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue_" + i);
|
||||
|
||||
if (temporary) {
|
||||
session.createTemporaryQueue(addressName, queueName, (SimpleString) null);
|
||||
} else {
|
||||
session.createQueue(addressName, queueName, null, true);
|
||||
}
|
||||
session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setDurable(!temporary).setTemporary(temporary));
|
||||
|
||||
ClientProducer producer = session.createProducer(addressName);
|
||||
|
||||
|
@ -236,7 +233,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
session.start();
|
||||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
session.createQueue(queueName, queueName, null, true);
|
||||
session.createQueue(new QueueConfiguration(queueName));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -290,7 +287,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -354,11 +351,11 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName3 = new SimpleString("DuplicateDetectionTestQueue3");
|
||||
|
||||
session.createQueue(queueName1, queueName1, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName1).setDurable(false));
|
||||
|
||||
session.createQueue(queueName2, queueName2, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName2).setDurable(false));
|
||||
|
||||
session.createQueue(queueName3, queueName3, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName3).setDurable(false));
|
||||
|
||||
ClientProducer producer1 = session.createProducer(queueName1);
|
||||
ClientConsumer consumer1 = session.createConsumer(queueName1);
|
||||
|
@ -491,7 +488,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -533,7 +530,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -569,7 +566,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -621,7 +618,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -661,9 +658,9 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queue2 = new SimpleString("queue2");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
session.createQueue(queue2, queue2, null, false);
|
||||
session.createQueue(new QueueConfiguration(queue2).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -741,7 +738,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -810,7 +807,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -881,7 +878,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -951,7 +948,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1013,7 +1010,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, true);
|
||||
session.createQueue(new QueueConfiguration(queueName));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1091,7 +1088,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1182,7 +1179,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1218,7 +1215,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
session.start();
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1257,7 +1254,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1288,7 +1285,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
session.start();
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1322,7 +1319,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1358,7 +1355,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
session.start();
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1395,7 +1392,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1433,7 +1430,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
session.start();
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1462,7 +1459,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1504,7 +1501,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
session.start();
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1563,7 +1560,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1603,7 +1600,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
session.start();
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1644,7 +1641,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1680,7 +1677,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
session.start();
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1721,7 +1718,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(queueName);
|
||||
|
||||
|
@ -1761,7 +1758,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
|
|||
|
||||
session.start();
|
||||
|
||||
session.createQueue(queueName, queueName, null, false);
|
||||
session.createQueue(new QueueConfiguration(queueName).setDurable(false));
|
||||
|
||||
producer = session.createProducer(queueName);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientMessage;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientProducer;
|
||||
|
@ -87,7 +88,7 @@ public class SimpleTest extends ActiveMQTestBase {
|
|||
final String addressName = "simpleAddress";
|
||||
|
||||
// Create a queue bound to a particular address where the test will send to & consume from.
|
||||
session.createQueue(addressName, RoutingType.ANYCAST, queueName);
|
||||
session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST));
|
||||
|
||||
// Create a producer to send a message to the previously created address.
|
||||
ClientProducer producer = session.createProducer(addressName);
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientMessage;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientProducer;
|
||||
|
@ -44,7 +45,7 @@ public class SingleServerSimpleTest extends SingleServerTestBase {
|
|||
final String addressName = "simpleAddress";
|
||||
|
||||
// Create a queue bound to a particular address where the test will send to & consume from.
|
||||
session.createQueue(addressName, RoutingType.ANYCAST, queueName);
|
||||
session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST));
|
||||
|
||||
// Create a producer to send a message to the previously created address.
|
||||
ClientProducer producer = session.createProducer(addressName);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.tests.integration;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
|
||||
|
@ -69,7 +70,7 @@ public class String64KLimitTest extends ActiveMQTestBase {
|
|||
SimpleString address = RandomUtil.randomSimpleString();
|
||||
SimpleString queue = RandomUtil.randomSimpleString();
|
||||
|
||||
session.createQueue(address, queue, false);
|
||||
session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(address);
|
||||
ClientConsumer consumer = session.createConsumer(queue);
|
||||
|
@ -133,7 +134,7 @@ public class String64KLimitTest extends ActiveMQTestBase {
|
|||
SimpleString address = RandomUtil.randomSimpleString();
|
||||
SimpleString queue = RandomUtil.randomSimpleString();
|
||||
|
||||
session.createQueue(address, queue, false);
|
||||
session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false));
|
||||
|
||||
ClientProducer producer = session.createProducer(address);
|
||||
ClientConsumer consumer = session.createConsumer(queue);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue