Package org.apache.activemq

Examples of org.apache.activemq.ActiveMQConnectionFactory


    }

    @Override
    protected float load(String accountNumber) throws AccountNotFoundException {
        try {
            ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(url);
            Connection conn = connFac.createConnection();
            conn.start();
            Session session = conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
            QueueBrowser browser = session.createBrowser(queue, "accountNumber = '" + accountNumber + "'");
            Enumeration msgs = browser.getEnumeration();
            if (msgs.hasMoreElements()) {
View Full Code Here


    }

    @Override
    protected void save(String accountNumber, float balance) throws AccountNotFoundException {
        try {
            ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(url);
            Connection conn = connFac.createConnection();
            conn.start();
            ActiveMQSession session = (ActiveMQSession)conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
            MessageConsumer consumer = session.createConsumer(queue, "accountNumber = '" + accountNumber + "'");
            Message msg = consumer.receive(1000);
            if (msg == null) {
View Full Code Here

            throw error;
        }
    }

    private void consumer() throws JMSException {
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
                BROKER_URL);
        Connection connection = connectionFactory.createConnection();
        connection.start();

        Session session = connection.createSession(false,
                Session.AUTO_ACKNOWLEDGE);
        Destination destination = session.createTopic(TOPIC_NAME);
View Full Code Here

            throw error;
        }
    }

    private void consumer(String brokerUrl, String topic) throws JMSException {
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
                brokerUrl);
        Connection connection = connectionFactory.createConnection();
        connection.start();

        Session session = connection.createSession(false,
                Session.AUTO_ACKNOWLEDGE);
        Destination destination = session.createTopic(topic);
View Full Code Here

        }
    }

    private void createAndStartConnection(String userName, String password,
                                          String url) throws JMSException {
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
                userName, password, url);
        connection = (ActiveMQConnection) connectionFactory.createConnection();
        connection.start();
        LOG.info("Connected successfully to " + url);
    }
View Full Code Here

            throw error;
        }
    }

    private void consumer() throws JMSException {
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
                BROKER_URL);
        Connection connection = connectionFactory.createConnection();
        connection.start();

        Session session = connection.createSession(false,
                Session.AUTO_ACKNOWLEDGE);
        Destination destination = session.createTopic(TOPIC_NAME);
View Full Code Here

            throw error;
        }
    }

    private void consumer() throws JMSException {
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
                BROKER_URL);
        Connection connection = connectionFactory.createConnection();
        connection.start();

        Session session = connection.createSession(false,
                Session.AUTO_ACKNOWLEDGE);
        Destination destination = session.createTopic(TOPIC_NAME);
View Full Code Here

            }
        };
        broker.getContainer().addListener(componentListener);
        try {
            if (connectionFactory == null) {
                connectionFactory = new ActiveMQConnectionFactory(jmsURL);
            }

            // Inbound connector
            ActiveMQDestination dest = new ActiveMQQueue(INBOUND_PREFIX + broker.getContainer().getName());
            containerConnector = new Connector(dest, this, true);
View Full Code Here

                    .getResourceAdapterInstances()[0]);
            if (kernel.isRunning(resourceAdapterAbstractName)) {
                String serverUrl = (String) kernel.getAttribute(resourceAdapterAbstractName, "ServerUrl");
                String userName = (String) kernel.getAttribute(resourceAdapterAbstractName, "UserName");
                String password = (String) kernel.getAttribute(resourceAdapterAbstractName, "Password");
                return new ActiveMQConnectionFactory(userName, password, serverUrl);
            }
            throw new JMSException("Fail to create ActiveMQConnectionFactory for the resource adapter module is not in running status");
        } catch (JMSException e) {
            throw e;
        } catch (Exception e) {
View Full Code Here

        }
        return false;
    }

    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 {
View Full Code Here

TOP

Related Classes of org.apache.activemq.ActiveMQConnectionFactory

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.