Package org.apache.activemq

Examples of org.apache.activemq.ActiveMQConnection.start()


        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + url + ")");
        cf.setWatchTopicAdvisories(watchTopicAdvisories);
        cf.setDispatchAsync(false);

        final ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
        connection.start();

        final Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final Queue destination = producerSession.createQueue(QUEUE_NAME + "?consumer.prefetchSize=" + prefetch);

        final Session consumerSession = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
View Full Code Here


        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + url + ")");
        cf.setWatchTopicAdvisories(watchTopicAdvisories);
        cf.setDispatchAsync(false);

        final ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
        connection.start();

        final Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final Queue destination = producerSession.createQueue(QUEUE_NAME
                + "?consumer.prefetchSize=" + prefetch);
View Full Code Here

        broker.start();

        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + url + ")");
        cf.setConsumerFailoverRedeliveryWaitPeriod(10000);
        final ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
        connection.start();

        final Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final Queue destination = producerSession.createQueue(QUEUE_NAME);

        final Session consumerSession = connection.createSession(true, Session.SESSION_TRANSACTED);
View Full Code Here

    }

    private Message receiveMessage(ActiveMQConnectionFactory cf,
            Queue destination) throws Exception {
        final ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
        connection.start();
        final Session consumerSession = connection.createSession(true, Session.SESSION_TRANSACTED);
        final MessageConsumer consumer = consumerSession.createConsumer(destination);
        Message msg = consumer.receive(5000);
        consumerSession.commit();
        connection.close();
View Full Code Here

       
        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + url + ")");
        cf.setWatchTopicAdvisories(watchTopicAdvisories);
       
        final ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
        connection.start();
       
        final Session consumerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final Queue destination = consumerSession.createQueue(QUEUE_NAME + "?jms.consumer.prefetch=" + prefetch);

        final Vector<TestConsumer> testConsumers = new Vector<TestConsumer>();
View Full Code Here

                policy.setUseExponentialBackOff(false);
                policy.setBackOffMultiplier((short) 5);

                connection.setClientID(getClientId());
                connection.setExceptionListener(this);
                connection.start();

                processMessages(connection);
            } finally {
                connection.close();
                connection = null;
View Full Code Here

            ActiveMQConnection connection = null;

            try {
                connection = (ActiveMQConnection) connectionFactory.createConnection();
                connection.setExceptionListener(this);
                connection.start();

                sendMessages(connection);
            } finally {
                if (connection != null) {
                    try {
View Full Code Here

                      return;
                  }

              }
          };
          cx.start();
          Thread producerThread = new Thread(r);
          producerThread.start();
          producerThread.join(30000);
          cx.close();
          // We should have a few timeout exceptions as memory store will fill up
View Full Code Here

                      return;
                  }

              }
          };
          cx.start();
          Thread producerThread = new Thread(r);
          producerThread.start();
          producerThread.join(30000);
          cx.close();
          // We should have a few timeout exceptions as memory store will fill up
View Full Code Here

   
    protected void createClients() throws Exception {
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(CLIENT_URL);
        for (int i =0;i < NUMBER; i++) {
            ActiveMQConnection c = (ActiveMQConnection) factory.createConnection();
            c.start();
            Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
            Queue queue  = s.createQueue(getClass().getName());
            MessageConsumer consumer = s.createConsumer(queue);
            connections.add(c);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.