Java Code Examples for org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory#getStaticConnectors()
The following examples show how to use
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory#getStaticConnectors() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConnectionFactorySerializationTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test public void testConnectionFactoryStatic1() throws Exception { createStaticFactory(true); cf = (ActiveMQConnectionFactory) namingContext.lookup("/MyConnectionFactory"); // apparently looking up the connection factory with the org.apache.activemq.artemis.jms.tests.tools.container.InVMInitialContextFactory // is not enough to actually serialize it so we serialize it manually byte[] x = serialize(cf); ActiveMQConnectionFactory y = deserialize(x, ActiveMQConnectionFactory.class); checkEquals(cf, y); Assert.assertEquals(cf.isHA(), y.isHA()); TransportConfiguration[] staticConnectors = y.getStaticConnectors(); Assert.assertEquals(staticConnectors.length, 2); TransportConfiguration tc0 = cf.getStaticConnectors()[0]; TransportConfiguration y0 = y.getStaticConnectors()[0]; Map<String, Object> ctParams = tc0.getParams(); Map<String, Object> y0Params = y0.getParams(); Assert.assertEquals(ctParams.size(), y0Params.size()); for (String key : y0Params.keySet()) { Assert.assertEquals(ctParams.get(key), y0Params.get(key)); } }
Example 2
Source File: ConnectionFactoryURITest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test public void testTCPAllNettyConnectorPropertiesMultiple() throws Exception { Map<String, Object> props = new HashMap<>(); Set<String> allowableConnectorKeys = TransportConstants.ALLOWABLE_CONNECTOR_KEYS; StringBuilder sb = new StringBuilder(); sb.append("(tcp://localhost0:61616?");//localhost1:61617,localhost2:61618,localhost3:61619)&ha=true"); populateConnectorParams(props, allowableConnectorKeys, sb); Map<String, Object> props2 = new HashMap<>(); sb.append(",tcp://localhost1:61617?"); populateConnectorParams(props2, allowableConnectorKeys, sb); Map<String, Object> props3 = new HashMap<>(); sb.append(",tcp://localhost2:61618?"); populateConnectorParams(props3, allowableConnectorKeys, sb); sb.append(")?ha=true&clientID=myID"); ActiveMQConnectionFactory factory = parser.newObject(parser.expandURI(sb.toString()), null); TransportConfiguration[] staticConnectors = factory.getStaticConnectors(); Assert.assertEquals(3, staticConnectors.length); checkTC(props, staticConnectors[0], 0); checkTC(props2, staticConnectors[1], 1); checkTC(props3, staticConnectors[2], 2); }
Example 3
Source File: ActiveMQConnectionFactoryTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
private void assertFactoryParams(final ActiveMQConnectionFactory cf, final TransportConfiguration[] staticConnectors, final DiscoveryGroupConfiguration discoveryGroupConfiguration, final String clientID, final long clientFailureCheckPeriod, final long connectionTTL, final long callTimeout, final long callFailoverTimeout, final int minLargeMessageSize, final int consumerWindowSize, final int consumerMaxRate, final int confirmationWindowSize, final int producerMaxRate, final boolean blockOnAcknowledge, final boolean blockOnDurableSend, final boolean blockOnNonDurableSend, final boolean autoGroup, final boolean preAcknowledge, final String loadBalancingPolicyClassName, final int dupsOKBatchSize, final int transactionBatchSize, final long initialWaitTimeout, final boolean useGlobalPools, final int scheduledThreadPoolMaxSize, final int threadPoolMaxSize, final long retryInterval, final double retryIntervalMultiplier, final int reconnectAttempts) { TransportConfiguration[] cfStaticConnectors = cf.getStaticConnectors(); if (staticConnectors == null) { Assert.assertNull(staticConnectors); } else { Assert.assertEquals(staticConnectors.length, cfStaticConnectors.length); for (int i = 0; i < staticConnectors.length; i++) { Assert.assertEquals(staticConnectors[i], cfStaticConnectors[i]); } } Assert.assertEquals(cf.getClientID(), clientID); Assert.assertEquals(cf.getClientFailureCheckPeriod(), clientFailureCheckPeriod); Assert.assertEquals(cf.getConnectionTTL(), connectionTTL); Assert.assertEquals(cf.getCallTimeout(), callTimeout); Assert.assertEquals(cf.getCallFailoverTimeout(), callFailoverTimeout); Assert.assertEquals(cf.getMinLargeMessageSize(), minLargeMessageSize); Assert.assertEquals(cf.getConsumerWindowSize(), consumerWindowSize); Assert.assertEquals(cf.getConsumerMaxRate(), consumerMaxRate); Assert.assertEquals(cf.getConfirmationWindowSize(), confirmationWindowSize); Assert.assertEquals(cf.getProducerMaxRate(), producerMaxRate); Assert.assertEquals(cf.isBlockOnAcknowledge(), blockOnAcknowledge); Assert.assertEquals(cf.isBlockOnDurableSend(), blockOnDurableSend); Assert.assertEquals(cf.isBlockOnNonDurableSend(), blockOnNonDurableSend); Assert.assertEquals(cf.isAutoGroup(), autoGroup); Assert.assertEquals(cf.isPreAcknowledge(), preAcknowledge); Assert.assertEquals(cf.getConnectionLoadBalancingPolicyClassName(), loadBalancingPolicyClassName); Assert.assertEquals(cf.getDupsOKBatchSize(), dupsOKBatchSize); Assert.assertEquals(cf.getTransactionBatchSize(), transactionBatchSize); Assert.assertEquals(cf.isUseGlobalPools(), useGlobalPools); Assert.assertEquals(cf.getScheduledThreadPoolMaxSize(), scheduledThreadPoolMaxSize); Assert.assertEquals(cf.getThreadPoolMaxSize(), threadPoolMaxSize); Assert.assertEquals(cf.getRetryInterval(), retryInterval); Assert.assertEquals(cf.getRetryIntervalMultiplier(), retryIntervalMultiplier, 0.00001); Assert.assertEquals(cf.getReconnectAttempts(), reconnectAttempts); }
Example 4
Source File: TCPSchema.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Override protected URI internalNewURI(ActiveMQConnectionFactory bean) throws Exception { String query = BeanSupport.getData(null, bean); TransportConfiguration[] staticConnectors = bean.getStaticConnectors(); return TCPServerLocatorSchema.getURI(query, staticConnectors); }