예제 #1
0
 private void configureQueues(QueueConfig... queueConfigs)
     throws JMSException, IllegalAccessException, InstantiationException {
   for (QueueConfig queueConfig : queueConfigs) {
     jmsConfig
         .getQueueConfigurations()
         .add(
             new JMSQueueConfigurationImpl(
                 queueConfig.getName(), null, true, "/queue/" + queueConfig.getName()));
   }
 }
예제 #2
0
  public void testParsing() throws Exception {
    Configuration config = createDefaultConfig();

    // anything so the parsing will work
    config.getConnectorConfigurations().put("netty", new TransportConfiguration());

    JMSServerConfigParser parser = new JMSServerConfigParserImpl();

    String conf = "hornetq-jms-for-JMSServerDeployerTest.xml";
    URL confURL = Thread.currentThread().getContextClassLoader().getResource(conf);

    InputStream stream = confURL.openStream();

    JMSConfiguration jmsconfig = parser.parseConfiguration(stream);
    stream.close();

    ConnectionFactoryConfiguration cfConfig = jmsconfig.getConnectionFactoryConfigurations().get(0);

    assertEquals(1234, cfConfig.getClientFailureCheckPeriod());
    assertEquals(5678, cfConfig.getCallTimeout());
    assertEquals(12345, cfConfig.getConsumerWindowSize());
    assertEquals(6789, cfConfig.getConsumerMaxRate());
    assertEquals(123456, cfConfig.getConfirmationWindowSize());
    assertEquals(7712652, cfConfig.getProducerWindowSize());
    assertEquals(789, cfConfig.getProducerMaxRate());
    assertEquals(12, cfConfig.getMinLargeMessageSize());
    assertEquals(true, cfConfig.isCompressLargeMessages());
    assertEquals("TestClientID", cfConfig.getClientID());
    assertEquals(3456, cfConfig.getDupsOKBatchSize());
    assertEquals(4567, cfConfig.getTransactionBatchSize());
    assertEquals(true, cfConfig.isBlockOnAcknowledge());
    assertEquals(false, cfConfig.isBlockOnNonDurableSend());
    assertEquals(true, cfConfig.isBlockOnDurableSend());
    assertEquals(false, cfConfig.isAutoGroup());
    assertEquals(true, cfConfig.isPreAcknowledge());
    assertEquals(2345, cfConfig.getConnectionTTL());
    assertEquals("FooClass", cfConfig.getLoadBalancingPolicyClassName());
    assertEquals(34, cfConfig.getReconnectAttempts());
    assertEquals(5, cfConfig.getRetryInterval());
    assertEquals(6.0, cfConfig.getRetryIntervalMultiplier());
    assertEquals(300, cfConfig.getMaxRetryInterval());
    assertEquals(true, cfConfig.isCacheLargeMessagesClient());

    assertEquals(1, jmsconfig.getQueueConfigurations().size());

    JMSQueueConfiguration queueConfig = jmsconfig.getQueueConfigurations().get(0);
    assertEquals("fullConfigurationQueue", queueConfig.getName());
    assertEquals(2, queueConfig.getBindings().length);
    assertEquals("/fullConfigurationQueue", queueConfig.getBindings()[0]);
    assertEquals("/queue/fullConfigurationQueue", queueConfig.getBindings()[1]);

    assertEquals(1, jmsconfig.getTopicConfigurations().size());
    TopicConfiguration topicConfig = jmsconfig.getTopicConfigurations().get(0);
    assertEquals("fullConfigurationTopic", topicConfig.getName());
    assertEquals(2, topicConfig.getBindings().length);
    assertEquals("/fullConfigurationTopic", topicConfig.getBindings()[0]);
    assertEquals("/topic/fullConfigurationTopic", topicConfig.getBindings()[1]);
  }
예제 #3
0
 private void configureConnectionFactory() {
   ConnectionFactoryConfiguration cfConfig =
       new ConnectionFactoryConfigurationImpl("cf", false, singletonList("connector"), "/cf");
   /*see https://community.jboss.org/thread/160367
    Re: Connection timeout issues - Connection failure has been detected
    In my case, below configuration (made on JBoss 7.1.1.Final) has helped:
    <client-failure-check-period>2147483646</client-failure-check-period>
    <connection-ttl>-1</connection-ttl>
    <reconnect-attempts>-1</reconnect-attempts>
   */
   cfConfig.setClientFailureCheckPeriod(Long.MAX_VALUE);
   cfConfig.setConnectionTTL(-1);
   cfConfig.setReconnectAttempts(-1);
   jmsConfig.getConnectionFactoryConfigurations().add(cfConfig);
 }