@Test public void testNoReconnectCloseAfterFailToReconnectWithTempQueue() throws Exception { ActiveMQConnectionFactory jbcf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(INVM_CONNECTOR_FACTORY)); jbcf.setReconnectAttempts(0); Connection conn = jbcf.createConnection(); Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); sess.createTemporaryQueue(); Thread.sleep(2000); this.server.stop(); this.server.start(); sess.close(); conn.close(); }
@Test public void testNoReconnectCloseAfterFailToReconnectWithTopicConsumer() throws Exception { ActiveMQConnectionFactory jbcf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(INVM_CONNECTOR_FACTORY)); jbcf.setReconnectAttempts(0); Connection conn = jbcf.createConnection(); Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); ClientSession coreSession = ((ActiveMQSession) sess).getCoreSession(); coreSession.createQueue("mytopic", "blahblah", null, false); Topic topic = ActiveMQJMSClient.createTopic("mytopic"); //Create a non durable subscriber sess.createConsumer(topic); Thread.sleep(2000); this.server.stop(); this.server.start(); sess.close(); conn.close(); }
private void createCamelContext() throws Exception { CamelContext camelContext = getContext(); ActiveMQConnectionFactory factory = ActiveMQJMSClient.createConnectionFactory( "(tcp://0.0.0.0:5672,tcp://0.0.0.0:61617)?ha=true;sslEnabled=true;enabledCipherSuites=TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256;enabledProtocols=TLSv1.1,TLSv1.2", "name"); factory.setRetryInterval(1000); factory.setRetryIntervalMultiplier(1.0); factory.setReconnectAttempts(-1); Sjms2Component sjms2 = new Sjms2Component(); ConnectionFactoryResource connectionResource = new ConnectionFactoryResource(1, factory, "admin", "admin"); sjms2.setConnectionResource(connectionResource); camelContext.addComponent("sjms2", sjms2); }
@Test public void testCloseConnectionAfterServerIsShutdown() throws Exception { server.start(); jbcf = createConnectionFactory(); jbcf.setBlockOnDurableSend(true); jbcf.setBlockOnNonDurableSend(true); jbcf.setReconnectAttempts(-1); conn = jbcf.createConnection(); server.stop(); conn.close(); }
cf.setReconnectAttempts(0); cf.setInitialConnectAttempts(0); cf.setEnable1xPrefixes(raProperties.isEnable1xPrefixes() == null ? false : raProperties.isEnable1xPrefixes());
jbcf.setReconnectAttempts(-1); jbcf.setBlockOnDurableSend(true); jbcf.setBlockOnNonDurableSend(true);
cf.setReconnectAttempts(0); cf.setInitialConnectAttempts(0); cf.setEnable1xPrefixes(raProperties.isEnable1xPrefixes() == null ? false : raProperties.isEnable1xPrefixes());
@Test public void testCreateQueue() throws Exception { liveJMSServer.createQueue(true, "queue1", null, true, "/queue/queue1"); assertNotNull(ctx1.lookup("/queue/queue1")); ActiveMQConnectionFactory jbcf = ActiveMQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, livetc); jbcf.setReconnectAttempts(-1); Connection conn = null; try { conn = JMSUtil.createConnectionAndWaitForTopology(jbcf, 2, 5); Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); ClientSession coreSession = ((ActiveMQSession) sess).getCoreSession(); JMSUtil.crash(liveServer, coreSession); assertNotNull(ctx2.lookup("/queue/queue1")); } finally { if (conn != null) { conn.close(); } } }
@Test public void testCreateTopic() throws Exception { liveJMSServer.createTopic(true, "topic", "/topic/t1"); assertNotNull(ctx1.lookup("//topic/t1")); ActiveMQConnectionFactory jbcf = ActiveMQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, livetc); jbcf.setReconnectAttempts(-1); Connection conn = null; try { conn = JMSUtil.createConnectionAndWaitForTopology(jbcf, 2, 5); Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); ClientSession coreSession = ((ActiveMQSession) sess).getCoreSession(); JMSUtil.crash(liveServer, coreSession); assertNotNull(ctx2.lookup("/topic/t1")); } finally { if (conn != null) { conn.close(); } } }
jbcfBackup.setBlockOnDurableSend(true); jbcfBackup.setInitialConnectAttempts(-1); jbcfBackup.setReconnectAttempts(-1);
private void testReconnectSameNodeServerRestartedWithNonDurableSubOrTempQueue(final boolean nonDurableSub) throws Exception { ActiveMQConnectionFactory jbcf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(INVM_CONNECTOR_FACTORY)); jbcf.setReconnectAttempts(-1);
@Test public void testAutomaticFailover() throws Exception { ActiveMQConnectionFactory jbcf = ActiveMQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, livetc); jbcf.setReconnectAttempts(-1); jbcf.setBlockOnDurableSend(true); jbcf.setBlockOnNonDurableSend(true);
jbcfBackup.setBlockOnDurableSend(true); jbcfBackup.setInitialConnectAttempts(-1); jbcfBackup.setReconnectAttempts(-1);
jbcf.setBlockOnNonDurableSend(true); jbcf.setReconnectAttempts(-1);
@Test public void testAutomaticFailover() throws Exception { ActiveMQConnectionFactory jbcf = ActiveMQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, livetc); jbcf.setReconnectAttempts(-1); jbcf.setBlockOnDurableSend(true); jbcf.setBlockOnNonDurableSend(true);
cf.setRetryIntervalMultiplier(cfConfig.getRetryIntervalMultiplier()); cf.setMaxRetryInterval(cfConfig.getMaxRetryInterval()); cf.setReconnectAttempts(cfConfig.getReconnectAttempts()); cf.setFailoverOnInitialConnection(cfConfig.isFailoverOnInitialConnection()); cf.setCompressLargeMessage(cfConfig.isCompressLargeMessages());
cf.setReconnectAttempts(val2); } else { cf.setReconnectAttempts(-1);
factory.setRetryInterval(retryInterval); factory.setRetryIntervalMultiplier(retryIntervalMultiplier); factory.setReconnectAttempts(reconnectAttempts);
cf.setRetryInterval(retryInterval); cf.setRetryIntervalMultiplier(retryIntervalMultiplier); cf.setReconnectAttempts(reconnectAttempts); Assert.assertEquals(clientFailureCheckPeriod, cf.getClientFailureCheckPeriod()); Assert.assertEquals(connectionTTL, cf.getConnectionTTL());
cf.setReconnectAttempts(reconnectAttempts); Assert.fail("Should throw exception"); } catch (IllegalStateException e) {