NO-JIRA move divert specific routing types
This commit is contained in:
parent
6cb6e95c9b
commit
49f1c9935c
|
@ -18,6 +18,7 @@ package org.apache.activemq.artemis.api.config;
|
|||
|
||||
import org.apache.activemq.artemis.ArtemisConstants;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
|
||||
import org.apache.activemq.artemis.core.server.RoutingType;
|
||||
|
||||
/**
|
||||
|
@ -361,7 +362,7 @@ public final class ActiveMQDefaultConfiguration {
|
|||
private static boolean DEFAULT_DIVERT_EXCLUSIVE = false;
|
||||
|
||||
// how the divert should handle the message's routing type
|
||||
private static String DEFAULT_DIVERT_ROUTING_TYPE = RoutingType.STRIP.toString();
|
||||
private static String DEFAULT_DIVERT_ROUTING_TYPE = DivertConfigurationRoutingType.STRIP.toString();
|
||||
|
||||
// If true then the server will request a backup on another node
|
||||
private static boolean DEFAULT_HAPOLICY_REQUEST_BACKUP = false;
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* This class essentially mirrors {@code RoutingType} except it has some additional members to support special
|
||||
* configuration semantics for diverts. These additional members weren't put in {@code RoutingType} so as to not
|
||||
* confuse users.
|
||||
*/
|
||||
public enum DivertConfigurationRoutingType {
|
||||
|
||||
MULTICAST, ANYCAST, STRIP, PASS;
|
||||
|
||||
public byte getType() {
|
||||
switch (this) {
|
||||
case MULTICAST:
|
||||
return 0;
|
||||
case ANYCAST:
|
||||
return 1;
|
||||
case STRIP:
|
||||
return 2;
|
||||
case PASS:
|
||||
return 3;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static DivertConfigurationRoutingType getType(byte type) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
return MULTICAST;
|
||||
case 1:
|
||||
return ANYCAST;
|
||||
case 2:
|
||||
return STRIP;
|
||||
case 3:
|
||||
return PASS;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ package org.apache.activemq.artemis.core.server;
|
|||
|
||||
public enum RoutingType {
|
||||
|
||||
MULTICAST, ANYCAST, STRIP, PASS;
|
||||
MULTICAST, ANYCAST;
|
||||
|
||||
public byte getType() {
|
||||
switch (this) {
|
||||
|
@ -26,10 +26,6 @@ public enum RoutingType {
|
|||
return 0;
|
||||
case ANYCAST:
|
||||
return 1;
|
||||
case STRIP:
|
||||
return 2;
|
||||
case PASS:
|
||||
return 3;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
@ -41,10 +37,6 @@ public enum RoutingType {
|
|||
return MULTICAST;
|
||||
case 1:
|
||||
return ANYCAST;
|
||||
case 2:
|
||||
return STRIP;
|
||||
case 3:
|
||||
return PASS;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.activemq.artemis.core.config;
|
|||
import java.io.Serializable;
|
||||
|
||||
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
|
||||
import org.apache.activemq.artemis.core.server.RoutingType;
|
||||
import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
|
||||
import org.apache.activemq.artemis.utils.UUIDGenerator;
|
||||
|
||||
public class DivertConfiguration implements Serializable {
|
||||
|
@ -40,7 +40,7 @@ public class DivertConfiguration implements Serializable {
|
|||
|
||||
private String transformerClassName = null;
|
||||
|
||||
private RoutingType routingType = RoutingType.valueOf(ActiveMQDefaultConfiguration.getDefaultDivertRoutingType());
|
||||
private DivertConfigurationRoutingType routingType = DivertConfigurationRoutingType.valueOf(ActiveMQDefaultConfiguration.getDefaultDivertRoutingType());
|
||||
|
||||
public DivertConfiguration() {
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class DivertConfiguration implements Serializable {
|
|||
return transformerClassName;
|
||||
}
|
||||
|
||||
public RoutingType getRoutingType() {
|
||||
public DivertConfigurationRoutingType getRoutingType() {
|
||||
return routingType;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ public class DivertConfiguration implements Serializable {
|
|||
/**
|
||||
* @param routingType the routingType to set
|
||||
*/
|
||||
public DivertConfiguration setRoutingType(final RoutingType routingType) {
|
||||
public DivertConfiguration setRoutingType(final DivertConfigurationRoutingType routingType) {
|
||||
this.routingType = routingType;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.activemq.artemis.core.config.impl;
|
||||
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
|
||||
import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
|
||||
import org.apache.activemq.artemis.core.server.JournalType;
|
||||
import org.apache.activemq.artemis.core.server.RoutingType;
|
||||
import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
|
||||
|
@ -180,10 +181,10 @@ public final class Validators {
|
|||
@Override
|
||||
public void validate(final String name, final Object value) {
|
||||
String val = (String) value;
|
||||
if (val == null || !val.equals(RoutingType.ANYCAST.toString()) &&
|
||||
!val.equals(RoutingType.MULTICAST.toString()) &&
|
||||
!val.equals(RoutingType.PASS.toString()) &&
|
||||
!val.equals(RoutingType.STRIP.toString())) {
|
||||
if (val == null || !val.equals(DivertConfigurationRoutingType.ANYCAST.toString()) &&
|
||||
!val.equals(DivertConfigurationRoutingType.MULTICAST.toString()) &&
|
||||
!val.equals(DivertConfigurationRoutingType.PASS.toString()) &&
|
||||
!val.equals(DivertConfigurationRoutingType.STRIP.toString())) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.invalidRoutingType(val);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ import org.apache.activemq.artemis.core.config.storage.FileStorageConfiguration;
|
|||
import org.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory;
|
||||
import org.apache.activemq.artemis.core.security.Role;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
|
||||
import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
|
||||
import org.apache.activemq.artemis.core.server.RoutingType;
|
||||
import org.apache.activemq.artemis.core.server.JournalType;
|
||||
import org.apache.activemq.artemis.core.server.SecuritySettingPlugin;
|
||||
|
@ -1592,7 +1593,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
|
|||
|
||||
String transformerClassName = getString(e, "transformer-class-name", null, Validators.NO_CHECK);
|
||||
|
||||
RoutingType routingType = RoutingType.valueOf(getString(e, "routing-type", ActiveMQDefaultConfiguration.getDefaultDivertRoutingType(), Validators.DIVERT_ROUTING_TYPE));
|
||||
DivertConfigurationRoutingType routingType = DivertConfigurationRoutingType.valueOf(getString(e, "routing-type", ActiveMQDefaultConfiguration.getDefaultDivertRoutingType(), Validators.DIVERT_ROUTING_TYPE));
|
||||
|
||||
String filterString = null;
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
|||
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
|
||||
import org.apache.activemq.artemis.core.server.ConnectorServiceFactory;
|
||||
import org.apache.activemq.artemis.core.server.Consumer;
|
||||
import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
|
||||
import org.apache.activemq.artemis.core.server.JournalType;
|
||||
import org.apache.activemq.artemis.core.server.Queue;
|
||||
import org.apache.activemq.artemis.core.server.RoutingType;
|
||||
|
@ -1996,7 +1997,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
|
||||
clearIO();
|
||||
try {
|
||||
DivertConfiguration config = new DivertConfiguration().setName(name).setRoutingName(routingName).setAddress(address).setForwardingAddress(forwardingAddress).setExclusive(exclusive).setFilterString(filterString).setTransformerClassName(transformerClassName).setRoutingType(RoutingType.valueOf(routingType));
|
||||
DivertConfiguration config = new DivertConfiguration().setName(name).setRoutingName(routingName).setAddress(address).setForwardingAddress(forwardingAddress).setExclusive(exclusive).setFilterString(filterString).setTransformerClassName(transformerClassName).setRoutingType(DivertConfigurationRoutingType.valueOf(routingType));
|
||||
server.deployDivert(config);
|
||||
} finally {
|
||||
blockOnIO();
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.activemq.artemis.core.filter.Filter;
|
|||
import org.apache.activemq.artemis.core.persistence.StorageManager;
|
||||
import org.apache.activemq.artemis.core.postoffice.PostOffice;
|
||||
import org.apache.activemq.artemis.core.server.Divert;
|
||||
import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
|
||||
import org.apache.activemq.artemis.core.server.RoutingContext;
|
||||
import org.apache.activemq.artemis.core.server.RoutingType;
|
||||
import org.apache.activemq.artemis.core.server.ServerMessage;
|
||||
|
@ -51,7 +52,7 @@ public class DivertImpl implements Divert {
|
|||
|
||||
private final StorageManager storageManager;
|
||||
|
||||
private final RoutingType routingType;
|
||||
private final DivertConfigurationRoutingType routingType;
|
||||
|
||||
public DivertImpl(final SimpleString forwardAddress,
|
||||
final SimpleString uniqueName,
|
||||
|
@ -61,7 +62,7 @@ public class DivertImpl implements Divert {
|
|||
final Transformer transformer,
|
||||
final PostOffice postOffice,
|
||||
final StorageManager storageManager,
|
||||
final RoutingType routingType) {
|
||||
final DivertConfigurationRoutingType routingType) {
|
||||
this.forwardAddress = forwardAddress;
|
||||
|
||||
this.uniqueName = uniqueName;
|
||||
|
|
Loading…
Reference in New Issue