ARTEMIS-2074 URI not transposing ServerLocator on ConnectionFactory
This closes #2286 As it superceedes it
This commit is contained in:
parent
5b52780c6a
commit
d2d9a0e634
|
@ -67,6 +67,14 @@ public class ActiveMQConnectionFactory extends JNDIStorable implements Connectio
|
|||
|
||||
private static final long serialVersionUID = 6730844785641767519L;
|
||||
|
||||
public ServerLocator setUseTopologyForLoadBalancing(boolean useTopologyForLoadBalancing) {
|
||||
return serverLocator.setUseTopologyForLoadBalancing(useTopologyForLoadBalancing);
|
||||
}
|
||||
|
||||
public boolean getUseTopologyForLoadBalancing() {
|
||||
return serverLocator.getUseTopologyForLoadBalancing();
|
||||
}
|
||||
|
||||
private ServerLocator serverLocator;
|
||||
|
||||
private String clientID;
|
||||
|
|
|
@ -36,4 +36,13 @@ public abstract class AbstractCFSchema extends URISchema<ActiveMQConnectionFacto
|
|||
return BeanSupport.setData(uri, new JMSConnectionOptions(), query);
|
||||
}
|
||||
|
||||
|
||||
protected ActiveMQConnectionFactory setData(URI uri,
|
||||
Map<String, String> query,
|
||||
ActiveMQConnectionFactory factory) throws Exception {
|
||||
BeanSupport.setData(uri, factory.getServerLocator(), query);
|
||||
return BeanSupport.setData(uri, factory, query);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,9 @@ public class InVMSchema extends AbstractCFSchema {
|
|||
String name) throws Exception {
|
||||
JMSConnectionOptions options = newConectionOptions(uri, query);
|
||||
ActiveMQConnectionFactory factory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(options.getFactoryTypeEnum(), InVMTransportConfigurationSchema.createTransportConfiguration(uri, query, name, "org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory"));
|
||||
return BeanSupport.setData(uri, factory, query);
|
||||
BeanSupport.setData(uri, factory, query);
|
||||
BeanSupport.setData(uri, factory.getServerLocator(), query);
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -52,7 +52,7 @@ public class JGroupsSchema extends AbstractCFSchema {
|
|||
} else {
|
||||
factory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dcConfig, options.getFactoryTypeEnum());
|
||||
}
|
||||
return BeanSupport.setData(uri, factory, query);
|
||||
return setData(uri, query, factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -57,7 +57,7 @@ public class TCPSchema extends AbstractCFSchema {
|
|||
factory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(options.getFactoryTypeEnum(), tcs);
|
||||
}
|
||||
|
||||
return BeanSupport.setData(uri, factory, query);
|
||||
return setData(uri, query, factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -49,7 +49,7 @@ public class UDPSchema extends AbstractCFSchema {
|
|||
} else {
|
||||
factory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, options.getFactoryTypeEnum());
|
||||
}
|
||||
return BeanSupport.setData(uri, factory, query);
|
||||
return setData(uri, query, factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -719,4 +719,15 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
|
|||
|
||||
connection.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUseTopologyForLoadBalancing() throws Exception {
|
||||
Hashtable<String, String> props = new Hashtable<>();
|
||||
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
|
||||
props.put("connectionFactory.ConnectionFactory", "vm://0?useTopologyForLoadBalancing=false");
|
||||
Context ctx = new InitialContext(props);
|
||||
|
||||
ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("ConnectionFactory");
|
||||
assertFalse(((ActiveMQConnectionFactory)connectionFactory).getServerLocator().getUseTopologyForLoadBalancing());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue