当前位置: 首页>>代码示例>>Java>>正文


Java ActiveMQConnectionFactory.setReconnectAttempts方法代码示例

本文整理汇总了Java中org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.setReconnectAttempts方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQConnectionFactory.setReconnectAttempts方法的具体用法?Java ActiveMQConnectionFactory.setReconnectAttempts怎么用?Java ActiveMQConnectionFactory.setReconnectAttempts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory的用法示例。


在下文中一共展示了ActiveMQConnectionFactory.setReconnectAttempts方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCreateQueue

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@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();
      }
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:28,代码来源:JMSFailoverTest.java

示例2: testCreateTopic

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@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();
      }
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:28,代码来源:JMSFailoverTest.java

示例3: internalCreateCFPOJO

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
/**
 * @param cfConfig
 * @return
 * @throws ActiveMQException
 */
protected ActiveMQConnectionFactory internalCreateCFPOJO(final ConnectionFactoryConfiguration cfConfig) throws ActiveMQException {
   ActiveMQConnectionFactory cf;
   if (cfConfig.getDiscoveryGroupName() != null) {
      DiscoveryGroupConfiguration groupConfig = server.getConfiguration().getDiscoveryGroupConfigurations().get(cfConfig.getDiscoveryGroupName());

      if (groupConfig == null) {
         throw ActiveMQJMSServerBundle.BUNDLE.discoveryGroupDoesntExist(cfConfig.getDiscoveryGroupName());
      }

      if (cfConfig.isHA()) {
         cf = ActiveMQJMSClient.createConnectionFactoryWithHA(groupConfig, cfConfig.getFactoryType());
      } else {
         cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(groupConfig, cfConfig.getFactoryType());
      }
   } else {
      if (cfConfig.getConnectorNames() == null || cfConfig.getConnectorNames().size() == 0) {
         throw ActiveMQJMSServerBundle.BUNDLE.noConnectorNameOnCF();
      }

      TransportConfiguration[] configs = new TransportConfiguration[cfConfig.getConnectorNames().size()];

      int count = 0;
      for (String name : cfConfig.getConnectorNames()) {
         TransportConfiguration connector = server.getConfiguration().getConnectorConfigurations().get(name);
         if (connector == null) {
            throw ActiveMQJMSServerBundle.BUNDLE.noConnectorNameConfiguredOnCF(name);
         }
         correctInvalidNettyConnectorHost(connector);
         configs[count++] = connector;
      }

      if (cfConfig.isHA()) {
         cf = ActiveMQJMSClient.createConnectionFactoryWithHA(cfConfig.getFactoryType(), configs);
      } else {
         cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(cfConfig.getFactoryType(), configs);
      }
   }

   cf.setClientID(cfConfig.getClientID());
   cf.setClientFailureCheckPeriod(cfConfig.getClientFailureCheckPeriod());
   cf.setConnectionTTL(cfConfig.getConnectionTTL());
   cf.setCallTimeout(cfConfig.getCallTimeout());
   cf.setCallFailoverTimeout(cfConfig.getCallFailoverTimeout());
   cf.setCacheLargeMessagesClient(cfConfig.isCacheLargeMessagesClient());
   cf.setMinLargeMessageSize(cfConfig.getMinLargeMessageSize());
   cf.setConsumerWindowSize(cfConfig.getConsumerWindowSize());
   cf.setConsumerMaxRate(cfConfig.getConsumerMaxRate());
   cf.setConfirmationWindowSize(cfConfig.getConfirmationWindowSize());
   cf.setProducerWindowSize(cfConfig.getProducerWindowSize());
   cf.setProducerMaxRate(cfConfig.getProducerMaxRate());
   cf.setBlockOnAcknowledge(cfConfig.isBlockOnAcknowledge());
   cf.setBlockOnDurableSend(cfConfig.isBlockOnDurableSend());
   cf.setBlockOnNonDurableSend(cfConfig.isBlockOnNonDurableSend());
   cf.setAutoGroup(cfConfig.isAutoGroup());
   cf.setPreAcknowledge(cfConfig.isPreAcknowledge());
   cf.setConnectionLoadBalancingPolicyClassName(cfConfig.getLoadBalancingPolicyClassName());
   cf.setTransactionBatchSize(cfConfig.getTransactionBatchSize());
   cf.setDupsOKBatchSize(cfConfig.getDupsOKBatchSize());
   cf.setUseGlobalPools(cfConfig.isUseGlobalPools());
   cf.setScheduledThreadPoolMaxSize(cfConfig.getScheduledThreadPoolMaxSize());
   cf.setThreadPoolMaxSize(cfConfig.getThreadPoolMaxSize());
   cf.setRetryInterval(cfConfig.getRetryInterval());
   cf.setRetryIntervalMultiplier(cfConfig.getRetryIntervalMultiplier());
   cf.setMaxRetryInterval(cfConfig.getMaxRetryInterval());
   cf.setReconnectAttempts(cfConfig.getReconnectAttempts());
   cf.setFailoverOnInitialConnection(cfConfig.isFailoverOnInitialConnection());
   cf.setCompressLargeMessage(cfConfig.isCompressLargeMessages());
   cf.setGroupID(cfConfig.getGroupID());
   cf.setProtocolManagerFactoryStr(cfConfig.getProtocolManagerFactoryStr());
   cf.setDeserializationBlackList(cfConfig.getDeserializationBlackList());
   cf.setDeserializationWhiteList(cfConfig.getDeserializationWhiteList());
   cf.setInitialMessagePacketSize(cfConfig.getInitialMessagePacketSize());

   return cf;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:81,代码来源:JMSServerManagerImpl.java

示例4: testGettersAndSetters

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Test
public void testGettersAndSetters() {
   ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, liveTC);

   long clientFailureCheckPeriod = RandomUtil.randomPositiveLong();
   long connectionTTL = RandomUtil.randomPositiveLong();
   long callTimeout = RandomUtil.randomPositiveLong();
   int minLargeMessageSize = RandomUtil.randomPositiveInt();
   int consumerWindowSize = RandomUtil.randomPositiveInt();
   int consumerMaxRate = RandomUtil.randomPositiveInt();
   int confirmationWindowSize = RandomUtil.randomPositiveInt();
   int producerMaxRate = RandomUtil.randomPositiveInt();
   boolean blockOnAcknowledge = RandomUtil.randomBoolean();
   boolean blockOnDurableSend = RandomUtil.randomBoolean();
   boolean blockOnNonDurableSend = RandomUtil.randomBoolean();
   boolean autoGroup = RandomUtil.randomBoolean();
   boolean preAcknowledge = RandomUtil.randomBoolean();
   String loadBalancingPolicyClassName = RandomUtil.randomString();
   boolean useGlobalPools = RandomUtil.randomBoolean();
   int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt();
   int threadPoolMaxSize = RandomUtil.randomPositiveInt();
   long retryInterval = RandomUtil.randomPositiveLong();
   double retryIntervalMultiplier = RandomUtil.randomDouble();
   int reconnectAttempts = RandomUtil.randomPositiveInt();
   cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
   cf.setConnectionTTL(connectionTTL);
   cf.setCallTimeout(callTimeout);
   cf.setMinLargeMessageSize(minLargeMessageSize);
   cf.setConsumerWindowSize(consumerWindowSize);
   cf.setConsumerMaxRate(consumerMaxRate);
   cf.setConfirmationWindowSize(confirmationWindowSize);
   cf.setProducerMaxRate(producerMaxRate);
   cf.setBlockOnAcknowledge(blockOnAcknowledge);
   cf.setBlockOnDurableSend(blockOnDurableSend);
   cf.setBlockOnNonDurableSend(blockOnNonDurableSend);
   cf.setAutoGroup(autoGroup);
   cf.setPreAcknowledge(preAcknowledge);
   cf.setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
   cf.setUseGlobalPools(useGlobalPools);
   cf.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
   cf.setThreadPoolMaxSize(threadPoolMaxSize);
   cf.setRetryInterval(retryInterval);
   cf.setRetryIntervalMultiplier(retryIntervalMultiplier);
   cf.setReconnectAttempts(reconnectAttempts);
   Assert.assertEquals(clientFailureCheckPeriod, cf.getClientFailureCheckPeriod());
   Assert.assertEquals(connectionTTL, cf.getConnectionTTL());
   Assert.assertEquals(callTimeout, cf.getCallTimeout());
   Assert.assertEquals(minLargeMessageSize, cf.getMinLargeMessageSize());
   Assert.assertEquals(consumerWindowSize, cf.getConsumerWindowSize());
   Assert.assertEquals(consumerMaxRate, cf.getConsumerMaxRate());
   Assert.assertEquals(confirmationWindowSize, cf.getConfirmationWindowSize());
   Assert.assertEquals(producerMaxRate, cf.getProducerMaxRate());
   Assert.assertEquals(blockOnAcknowledge, cf.isBlockOnAcknowledge());
   Assert.assertEquals(blockOnDurableSend, cf.isBlockOnDurableSend());
   Assert.assertEquals(blockOnNonDurableSend, cf.isBlockOnNonDurableSend());
   Assert.assertEquals(autoGroup, cf.isAutoGroup());
   Assert.assertEquals(preAcknowledge, cf.isPreAcknowledge());
   Assert.assertEquals(loadBalancingPolicyClassName, cf.getConnectionLoadBalancingPolicyClassName());
   Assert.assertEquals(useGlobalPools, cf.isUseGlobalPools());
   Assert.assertEquals(scheduledThreadPoolMaxSize, cf.getScheduledThreadPoolMaxSize());
   Assert.assertEquals(threadPoolMaxSize, cf.getThreadPoolMaxSize());
   Assert.assertEquals(retryInterval, cf.getRetryInterval());
   Assert.assertEquals(retryIntervalMultiplier, cf.getRetryIntervalMultiplier(), 0.0001);
   Assert.assertEquals(reconnectAttempts, cf.getReconnectAttempts());

   cf.close();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:68,代码来源:ActiveMQConnectionFactoryTest.java

示例5: testNoReconnectCloseAfterFailToReconnectWithTempQueue

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@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();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:23,代码来源:JMSReconnectTest.java

示例6: testNoReconnectCloseAfterFailToReconnectWithTopicConsumer

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@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();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:30,代码来源:JMSReconnectTest.java


注:本文中的org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.setReconnectAttempts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。