Package org.apache.activemq.pool

Examples of org.apache.activemq.pool.PooledConnectionFactory


        connectionFactory.setOptimizedMessageDispatch(true);
        connectionFactory.setUseAsyncSend(true);
        connectionFactory.setAlwaysSessionAsync(false);

        // use a pooled connection factory
        PooledConnectionFactory pooled = new PooledConnectionFactory(connectionFactory);
        pooled.setMaxConnections(8);
        return pooled;
    }
View Full Code Here


    public class AMQConnectionResource implements ConnectionResource {
        private PooledConnectionFactory pcf;

        public AMQConnectionResource(String connectString, int maxConnections) {
            pcf = new PooledConnectionFactory(connectString);
            pcf.setMaxConnections(maxConnections);
            pcf.start();
        }
View Full Code Here

    private CamelJmsTestHelper() {
    }

    public static PooledConnectionFactory createPooledConnectionFactory() {
        ConnectionFactory cf = createConnectionFactory(null);
        PooledConnectionFactory pooled = new PooledConnectionFactory();
        pooled.setConnectionFactory(cf);
        pooled.setMaxConnections(8);
        return pooled;
    }
View Full Code Here

        // Another way of guaranteeing order is to use persistent messages or transactions.
        connectionFactory.setUseAsyncSend(false);

        connectionFactory.setAlwaysSessionAsync(false);
        // use a pooled connection factory
        PooledConnectionFactory pooled = new PooledConnectionFactory(connectionFactory);
        pooled.setMaxConnections(8);
        return pooled;
    }
View Full Code Here

        connectionFactory.setOptimizedMessageDispatch(true);
        connectionFactory.setUseAsyncSend(true);
        connectionFactory.setAlwaysSessionAsync(false);

        // use a pooled connection factory
        PooledConnectionFactory pooled = new PooledConnectionFactory(connectionFactory);
        pooled.setMaxConnections(8);
        return pooled;
    }
View Full Code Here

  // This should fail with incubator-activemq-fuse-4.1.0.5
  public void testQueueLimitsWithOneBrokerSameConnection() throws Exception {

    BrokerService brokerService1 = null;
    ActiveMQConnectionFactory acf = null;
    PooledConnectionFactory pcf = null;
    DefaultMessageListenerContainer container1 = null;

    try {
      brokerService1 = createBrokerService("broker1", URL1, null);
      brokerService1.start();

      acf = createConnectionFactory(URL1);
      pcf = new PooledConnectionFactory(acf);

      // Only listen on the first queue.. let the 2nd queue fill up.
      doneLatch = new CountDownLatch(NUM_MESSAGE_TO_SEND);
      container1 = createDefaultMessageListenerContainer(acf,  new TestMessageListener1(500), QUEUE1_NAME);
      container1.afterPropertiesSet();
View Full Code Here

    BrokerService brokerService1 = null;
    BrokerService brokerService2 = null;
    ActiveMQConnectionFactory acf1 = null;
    ActiveMQConnectionFactory acf2 = null;
    PooledConnectionFactory pcf = null;
    DefaultMessageListenerContainer container1 = null;

    try {
      brokerService1 = createBrokerService("broker1", URL1, URL2);
      brokerService1.start();
      brokerService2 = createBrokerService("broker2", URL2, URL1);
      brokerService2.start();

      acf1 = createConnectionFactory(URL1);
      acf2 = createConnectionFactory(URL2);

      pcf = new PooledConnectionFactory(acf1);

      Thread.sleep(1000);

      doneLatch = new CountDownLatch(MAX_PRODUCERS * NUM_MESSAGE_TO_SEND);
      container1 = createDefaultMessageListenerContainer(acf2, new TestMessageListener1(500), QUEUE1_NAME);
View Full Code Here

    }

    private static String setupAmqComponentAndEndpoint(CamelContext camelContext, Properties messageBrokerProperties, String eventsToInsightsQueueName) {
        String brokerUrl = messageBrokerProperties.getProperty("activemq.broker.url");
        ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory(brokerUrl);
        PooledConnectionFactory pooledConnectionFactory = new PooledConnectionFactory(activeMQConnectionFactory);

        pooledConnectionFactory.setMaxConnections(8);
        pooledConnectionFactory.setMaximumActive(500);
        pooledConnectionFactory.setIdleTimeout(0); //No timeout for connections in the pool

        ActiveMQComponent activeMQComponent = ActiveMQComponent.activeMQComponent();
        activeMQComponent.setUsePooledConnection(true);
        activeMQComponent.setConnectionFactory(pooledConnectionFactory);
        camelContext.addComponent("amq", activeMQComponent);
View Full Code Here

    // This should fail with incubator-activemq-fuse-4.1.0.5
    public void testFailoverIssue() throws Exception {
        BrokerService brokerService1 = null;
        ActiveMQConnectionFactory acf;
        PooledConnectionFactory pcf;
        DefaultMessageListenerContainer container1 = null;
        try {
            brokerService1 = createBrokerService("broker1", URL1, null);
            brokerService1.start();
            acf = createConnectionFactory(URL1, USE_FAILOVER);
            pcf = new PooledConnectionFactory(acf);
            // Only listen on the first queue.. let the 2nd queue fill up.
            doneLatch = new CountDownLatch(TOTAL_MESSAGES);
            container1 = createDefaultMessageListenerContainer(acf, new TestMessageListener1(0), QUEUE1_NAME);
            container1.afterPropertiesSet();
            Thread.sleep(5000);
View Full Code Here

    // This should fail with incubator-activemq-fuse-4.1.0.5
    public void testQueueLimitsWithOneBrokerSameConnection() throws Exception {

        BrokerService brokerService1 = null;
        ActiveMQConnectionFactory acf = null;
        PooledConnectionFactory pcf = null;
        DefaultMessageListenerContainer container1 = null;

        try {
            brokerService1 = createBrokerService("broker1", URL1, null);
            brokerService1.start();

            acf = createConnectionFactory(URL1);
            pcf = new PooledConnectionFactory(acf);

            // Only listen on the first queue.. let the 2nd queue fill up.
            doneLatch = new CountDownLatch(NUM_MESSAGE_TO_SEND);
            container1 = createDefaultMessageListenerContainer(acf, new TestMessageListener1(500), QUEUE1_NAME);
            container1.afterPropertiesSet();
View Full Code Here

TOP

Related Classes of org.apache.activemq.pool.PooledConnectionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.