Package org.apache.activemq

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


    ActiveMQConnection connection = null;
    try {
      // Create the connection.
      ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
      connection = (ActiveMQConnection) connectionFactory.createConnection();
      connection.start();
      // Create the session
      Session session = connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE);
      if (topic) {
        destination = session.createTopic(subject);
      }
View Full Code Here


      ActiveMQConnection  connection = null;
        try {
            // Create the connection.
            ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
            connection = (ActiveMQConnection) connectionFactory.createConnection();
            connection.start();

            // Create the session
            Session session = connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE);
            if (topic) {
                destination = session.createTopic(subject);
View Full Code Here

    private BrokerInfo getBrokerInfo(PortletRequest portletRequest, JMSDestinationInfo destinationInfo) throws JMSException {
        ActiveMQConnectionFactory connectionFactory = createActiveMQConnectionFactory(portletRequest, destinationInfo);
        ActiveMQConnection connection = null;
        try {
            connection = (ActiveMQConnection) connectionFactory.createConnection();
            connection.start();
            return connection.getBrokerInfo();
        } finally {
            if (connection != null) {
                try {
                    connection.close();
View Full Code Here

    private BrokerInfo getBrokerInfo(PortletRequest portletRequest, JMSDestinationInfo destinationInfo) throws JMSException {
        ActiveMQConnectionFactory connectionFactory = createActiveMQConnectionFactory(portletRequest, destinationInfo);
        ActiveMQConnection connection = null;
        try {
            connection = (ActiveMQConnection) connectionFactory.createConnection();
            connection.start();
            return connection.getBrokerInfo();
        } finally {
            if (connection != null) {
                try {
                    connection.close();
View Full Code Here

        waitForMinTopicRegionConsumerCount("BrokerA", 1);

        ConnectionFactory factory = new ActiveMQConnectionFactory(forClient.getConnectUri());
        ActiveMQConnection conn = (ActiveMQConnection) factory.createConnection();
        conn.setWatchTopicAdvisories(false);
        conn.start();
        Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

        ConnectionFactory replyFactory = getConnectionFactory("BrokerB");
        for (int i = 0; i < 500; i++) {
            TemporaryQueue tempDest = session.createTemporaryQueue();
View Full Code Here

            ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) session.createConsumer(tempDest);
            producer.send(message);

            ActiveMQConnection replyConnection = (ActiveMQConnection) replyFactory.createConnection();
            replyConnection.setWatchTopicAdvisories(false);
            replyConnection.start();
            Session replySession = replyConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            ActiveMQMessageConsumer replyConsumer = (ActiveMQMessageConsumer) replySession.createConsumer(requestReplyDest);
            javax.jms.Message msg = replyConsumer.receive(10000);
            assertNotNull("request message not null: " + i, msg);
            MessageProducer replyProducer = replySession.createProducer(msg.getJMSReplyTo());
View Full Code Here

    }

    private ActiveMQConnection createConnection() throws Exception {
        ActiveMQConnection connection = (ActiveMQConnection)
                new ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getConnectUri()).createConnection();
        connection.start();
        return connection;
    }

    private void createBroker(boolean allowRemoteAddressInMbeanNames) throws Exception {
        broker = new BrokerService();
View Full Code Here

        final long timeout = 5000; // 5 seconds
        final String queueName = getClass().getName();

        ActiveMQConnectionFactory factoryA = new ActiveMQConnectionFactory(clientUrlA);
        ActiveMQConnection connectionA = (ActiveMQConnection) factoryA.createConnection();
        connectionA.start();
        Session sessionA = connectionA.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue queueA = sessionA.createQueue(queueName);
        MessageProducer producerA = sessionA.createProducer(queueA);

        ActiveMQConnectionFactory factoryB = new ActiveMQConnectionFactory(clientUrlB);
View Full Code Here

        Queue queueA = sessionA.createQueue(queueName);
        MessageProducer producerA = sessionA.createProducer(queueA);

        ActiveMQConnectionFactory factoryB = new ActiveMQConnectionFactory(clientUrlB);
        ActiveMQConnection connectionB = (ActiveMQConnection) factoryB.createConnection();
        connectionB.start();
        Session sessionB = connectionB.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue queueB = sessionB.createQueue(queueName);
        MessageConsumer consumerB = sessionA.createConsumer(queueB);

        // Test initial configuration is working
View Full Code Here

        }
    }

    private ActiveMQConnection createConnection(ActiveMQConnectionFactory factory) throws Exception {
        ActiveMQConnection c =(ActiveMQConnection) factory.createConnection();
        c.start();
        return c;
    }

    private ActiveMQConnectionFactory createConnectionFactory(BrokerService brokerService) throws Exception {
        String target = brokerService.getTransportConnectors().get(0).getPublishableConnectString();
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.