Package org.apache.activemq

Examples of org.apache.activemq.ActiveMQPrefetchPolicy


        MessageConsumer dlqConsumer = session.createConsumer(session.createQueue("ActiveMQ.DLQ"));
        connection.start();

        Connection consumerConnection = factory.createConnection();
        ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
        prefetchPolicy.setAll(10);
        ((ActiveMQConnection)consumerConnection).setPrefetchPolicy(prefetchPolicy);
        Session consumerSession = consumerConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
        MessageConsumer consumer = consumerSession.createConsumer(queue);
        consumerConnection.start();
View Full Code Here


    }

    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(
            broker.getTransportConnectors().get(0).getPublishableConnectString());
        ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
        prefetchPolicy.setAll(1);
        factory.setPrefetchPolicy(prefetchPolicy);

        factory.setDispatchAsync(true);
        return factory;
    }
View Full Code Here

    return sharedConnection;
  }

  private void addPrefetch(ActiveMQConnection aConnection) {
    ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
    prefetchPolicy.setQueuePrefetch(5);
    ((ActiveMQConnection) aConnection).setPrefetchPolicy(prefetchPolicy);
  }
View Full Code Here

    return sharedConnection;
  }

  private void addPrefetch(ActiveMQConnection aConnection) {
    ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
    prefetchPolicy.setQueuePrefetch(5);
    ((ActiveMQConnection) aConnection).setPrefetchPolicy(prefetchPolicy);
  }
View Full Code Here

    }
    return factory;
  }

  private ActiveMQPrefetchPolicy getPrefetchPolicy(int aPrefetchSize) {
    ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
    prefetchPolicy.setQueuePrefetch(aPrefetchSize);
    return prefetchPolicy;
  }
View Full Code Here

    // notifications.
    if (cntlr.isCasMultiplier()) {

      ActiveMQConnectionFactory cf = getNewConnectionFactory(ctx); // getTopLevelQueueConnectionFactory(
                                                                   // ctx );
      ActiveMQPrefetchPolicy prefetchPolicy = getPrefetchPolicy(MAX_PREFETCH_FOR_CAS_NOTIFICATION_Q);
      cf.setPrefetchPolicy(prefetchPolicy);
      // Create a listener and a temp queue for Free CAS notifications.
      UimaDefaultMessageListenerContainer connector = produceListenerConnector(cf,cntlr);
      // Direct all messages to the InputChannel
      //connector.setMessageListener(((JmsInputChannel) cntlr.getInputChannel()));
View Full Code Here

     * Returns the prefetch policy; not using bean properties to avoid breaking
     * compatibility with JCA configuration in J2EE
     */
    public ActiveMQPrefetchPolicy prefetchPolicy() {
        if (prefetchPolicy == null) {
            prefetchPolicy = new ActiveMQPrefetchPolicy();
        }
        return prefetchPolicy;
    }
View Full Code Here

        transportConnector.setBrokerService(broker);
        transportConnector.setTaskRunnerFactory(broker.getTaskRunnerFactory());
        transportConnector.start();
        SocketProxy socketProxy = new SocketProxy(transportConnector.getPublishableConnectURI());
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(socketProxy.getUrl());
        ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
        prefetchPolicy.setAll(4);
        connectionFactory.setPrefetchPolicy(prefetchPolicy);
        Connection c = connectionFactory.createConnection();
        connections.add(c);
        c.start();
        Session session = c.createSession(false, Session.CLIENT_ACKNOWLEDGE);
View Full Code Here

        ActiveMQConnectionFactory factoryB;
        factoryA = (ActiveMQConnectionFactory)getConnectionFactory("BrokerA");
        factoryB = (ActiveMQConnectionFactory)getConnectionFactory("BrokerB");

        // Set prefetch policy
        ActiveMQPrefetchPolicy policy = new ActiveMQPrefetchPolicy();
        policy.setAll(PREFETCH_COUNT);

        factoryA.setPrefetchPolicy(policy);
        factoryB.setPrefetchPolicy(policy);

        msgsClient1 = 0;
View Full Code Here

        if (producerBroker == null) {
            producerBroker = createProducerBroker(producerBindAddress);
        }
        consumerFactory = createConnectionFactory(consumerBindAddress);
        consumerFactory.setDispatchAsync(true);
        ActiveMQPrefetchPolicy policy = new ActiveMQPrefetchPolicy();
        policy.setQueuePrefetch(100);
        consumerFactory.setPrefetchPolicy(policy);
        producerFactory = createConnectionFactory(producerBindAddress);
        Connection con = consumerFactory.createConnection();
        Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
       
View Full Code Here

TOP

Related Classes of org.apache.activemq.ActiveMQPrefetchPolicy

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.