Package org.apache.activemq

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


            executor.execute(new Runnable() {
                public void run() {
                    try {
                        ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
                        connection.setExceptionListener(listener);
                        connection.start();
                        assertNotNull(connection.getBrokerName());
                        connections.add(connection);
                    } catch (Exception e) {
                        exceptions.put(Thread.currentThread(), e);
                    }
View Full Code Here


        connection.close();
    }

    private ActiveMQTextMessage receiveTestMessage(ActiveMQConnectionFactory factory) throws JMSException {
        ActiveMQConnection connection = (ActiveMQConnection)factory.createConnection();
        connection.start();
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageConsumer consumer = session.createConsumer(queue);
        ActiveMQTextMessage rc = (ActiveMQTextMessage)consumer.receive();
        connection.close();
        return rc;
View Full Code Here

        connection.close();
    }

    private ActiveMQBytesMessage receiveTestBytesMessage(ActiveMQConnectionFactory factory) throws JMSException, UnsupportedEncodingException {
        ActiveMQConnection connection = (ActiveMQConnection)factory.createConnection();
        connection.start();
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageConsumer consumer = session.createConsumer(queue);
        ActiveMQBytesMessage rc = (ActiveMQBytesMessage)consumer.receive();
        connection.close();
        return rc;
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

        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

    protected void createClients() throws Exception {
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(clientUrl);
        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

                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

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

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

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

        final MessageConsumer consumer = consumerSession.createConsumer(destination);
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

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.