This commit is contained in:
Justin Bertram 2021-05-24 13:38:07 -05:00
commit c2acb95a1e
2 changed files with 23 additions and 11 deletions

View File

@ -574,4 +574,8 @@ public interface ActiveMQClientLogger extends BasicLogger {
@Message(id = 214033, value = "Cannot resolve host ", @Message(id = 214033, value = "Cannot resolve host ",
format = Message.Format.MESSAGE_FORMAT) format = Message.Format.MESSAGE_FORMAT)
void unableToResolveHost(@Cause UnknownHostException e); void unableToResolveHost(@Cause UnknownHostException e);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212079, value = "The upstream connector from the downstream federation will ignore url parameter {0}", format = Message.Format.MESSAGE_FORMAT)
void ignoredParameterForDownstreamFederation(String name);
} }

View File

@ -21,6 +21,7 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.core.client.ActiveMQClientLogger;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
public class FederationDownstreamConfiguration extends FederationStreamConfiguration<FederationDownstreamConfiguration> { public class FederationDownstreamConfiguration extends FederationStreamConfiguration<FederationDownstreamConfiguration> {
@ -40,23 +41,30 @@ public class FederationDownstreamConfiguration extends FederationStreamConfigura
return upstreamConfiguration; return upstreamConfiguration;
} }
private void stripParam(Map<String, Object> params, String name) {
Object oldValue = params.remove(name);
if (oldValue != null) {
ActiveMQClientLogger.LOGGER.ignoredParameterForDownstreamFederation(name);
}
}
public void setUpstreamConfiguration(TransportConfiguration transportConfiguration) { public void setUpstreamConfiguration(TransportConfiguration transportConfiguration) {
final Map<String, Object> params = new HashMap<>(transportConfiguration.getParams()); final Map<String, Object> params = new HashMap<>(transportConfiguration.getParams());
//clear any TLS settings as they won't apply to the federated server that uses this config //clear any TLS settings as they won't apply to the federated server that uses this config
//The federated server that creates the upstream back will rely on its config from the acceptor for TLS //The federated server that creates the upstream back will rely on its config from the acceptor for TLS
params.remove(TransportConstants.SSL_ENABLED_PROP_NAME); stripParam(params, TransportConstants.SSL_ENABLED_PROP_NAME);
params.remove(TransportConstants.SSL_PROVIDER); stripParam(params, TransportConstants.SSL_PROVIDER);
params.remove(TransportConstants.SSL_KRB5_CONFIG_PROP_NAME); stripParam(params, TransportConstants.SSL_KRB5_CONFIG_PROP_NAME);
params.remove(TransportConstants.KEYSTORE_PATH_PROP_NAME); stripParam(params, TransportConstants.KEYSTORE_PATH_PROP_NAME);
params.remove(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME); stripParam(params, TransportConstants.KEYSTORE_PASSWORD_PROP_NAME);
params.remove(TransportConstants.KEYSTORE_PROVIDER_PROP_NAME); stripParam(params, TransportConstants.KEYSTORE_PROVIDER_PROP_NAME);
params.remove(TransportConstants.KEYSTORE_TYPE_PROP_NAME); stripParam(params, TransportConstants.KEYSTORE_TYPE_PROP_NAME);
params.remove(TransportConstants.TRUSTSTORE_PATH_PROP_NAME); stripParam(params, TransportConstants.TRUSTSTORE_PATH_PROP_NAME);
params.remove(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME); stripParam(params, TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME);
params.remove(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME); stripParam(params, TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME);
params.remove(TransportConstants.TRUSTSTORE_TYPE_PROP_NAME); stripParam(params, TransportConstants.TRUSTSTORE_TYPE_PROP_NAME);
this.upstreamConfiguration = new TransportConfiguration(transportConfiguration.getFactoryClassName(), params, this.upstreamConfiguration = new TransportConfiguration(transportConfiguration.getFactoryClassName(), params,
transportConfiguration.getName(), transportConfiguration.getExtraParams()); transportConfiguration.getName(), transportConfiguration.getExtraParams());