Package org.codehaus.activemq

Examples of org.codehaus.activemq.ActiveMQConnectionFactory


    /**
     * Factory method to create a new connection factory from the given environment
     */
    protected ActiveMQConnectionFactory createConnectionFactory(Hashtable environment) {
        ActiveMQConnectionFactory answer = new ActiveMQConnectionFactory();
        Properties properties = new Properties();
        properties.putAll(environment);
        answer.setProperties(properties);
        return answer;
    }
View Full Code Here


    public static void initContext(ServletContext context) {
        factory = initConnectionFactory(context);
        if (factory == null) {
            log.warn("No ConnectionFactory available in the ServletContext for: " + connectionFactoryAttribute);
            factory = new ActiveMQConnectionFactory("vm://localhost");
            context.setAttribute(connectionFactoryAttribute, factory);
        }
        queueConsumers = initQueueConsumers(context);
    }
View Full Code Here

            }

            boolean embeddedBroker = MessageServletSupport.asBoolean(servletContext.getInitParameter(embeddedBrokerInitParam));
            servletContext.log("Use embedded broker: " + embeddedBroker);

            ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerURL);
            factory.setUseEmbeddedBroker(embeddedBroker);

            connectionFactory = factory;
            servletContext.setAttribute(connectionFactoryAttribute, connectionFactory);
        }
        return connectionFactory;
View Full Code Here

        // which is either a URL or a resource on the classpath
        properties.put("brokerXmlConfig", "file:src/sample-conf/bdb-example.xml");
        properties.put("brokerURL", "vm://localhost");

        InitialContext context = new InitialContext(properties);
        ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) context.lookup("ConnectionFactory");

        // END SNIPPET: example
        return connectionFactory;
    }
View Full Code Here

    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
        // START SNIPPET: bean

        // configure the connection factory using
        // normal Java Bean property methods
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
        connectionFactory.setUseEmbeddedBroker(true);
        connectionFactory.setBrokerURL("vm://localhost");

        // configure the embedded broker using an XML config file
        // which is either a URL or a resource on the classpath
        connectionFactory.setBrokerXmlConfig("file:src/sample-conf/bdb-example.xml");

        // END SNIPPET: bean
        return connectionFactory;
    }
View Full Code Here

        initializeLocal();
        //start subscribing for already established subscriptions
    }

    private void initializeRemote() throws JMSException {
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(remoteUserName, remotePassword, uri);
        factory.setUseAsyncSend(true);
        remoteConnection = (ActiveMQConnection) factory.createConnection();
        remoteConnection.setClientID(brokerContainer.getBroker().getBrokerName() + "_NetworkChannel");
        TransportChannel transportChannel = remoteConnection.getTransportChannel();
        if (transportChannel instanceof CompositeTransportChannel) {
            CompositeTransportChannel composite = (CompositeTransportChannel) transportChannel;
            composite.setMaximumRetries(maximumRetries);
View Full Code Here

        remoteClusterName = receipt.getClusterName();
    }

    private void initializeLocal() throws JMSException {
        String brokerName = brokerContainer.getBroker().getBrokerName();
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://" + brokerName);
        factory.setUseAsyncSend(true);
        factory.setBrokerName(brokerName);
        localConnection = (ActiveMQConnection) factory.createConnection();
        localConnection.start();
        BrokerInfo info = new BrokerInfo();
        info.setBrokerName(remoteBrokerName);
        info.setClusterName(remoteClusterName);
        localConnection.asyncSendPacket(info);
View Full Code Here

        }
        return session;
    }

    protected Connection createConnection() throws JMSException, Exception {
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, pwd, url);
        return connectionFactory.createConnection();
    }
View Full Code Here

    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
        // START SNIPPET: bean

        // configure the connection factory using
        // normal Java Bean property methods
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
        connectionFactory.setUseEmbeddedBroker(true);

        // configure the embedded broker using an XML config file
        // which is either a URL or a resource on the classpath
        connectionFactory.setBrokerXmlConfig("file:src/sample-conf/bdb-example.xml");

        // you only need to configure the broker URL if you wish to change the
        // default connection mechanism, which in this test case we do
        connectionFactory.setBrokerURL("vm://localhost");

        // END SNIPPET: bean
        return connectionFactory;
    }
View Full Code Here

* @version $Revision: 1.1 $
*/
public class ActiveIOTopicSendReceiveTwoConnectionsTest extends JmsTopicSendReceiveWithTwoConnectionsTest {

    protected ActiveMQConnectionFactory createConnectionFactory() {
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
        factory.setBrokerURL("activeio:socket://localhost:61626");
        factory.setUseEmbeddedBroker(true);
        return factory;

    }
View Full Code Here

TOP

Related Classes of org.codehaus.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.