Package org.activemq

Examples of org.activemq.ActiveMQConnectionFactory


        receiveBroker = new BrokerContainerImpl("receiver");
        receiveBroker.addConnector("tcp://localhost:61616");
        receiveBroker.setPersistenceAdapter(createPersistenceAdapter());
        receiveBroker.start();

        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(receiveBroker, "tcp://localhost:61616");

        return factory;
    }
View Full Code Here


        return factory;
    }

    protected ActiveMQConnectionFactory createEmbeddedRemoteBrokerConnectionFactory() throws JMSException {
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
        connectionFactory.setUseEmbeddedBroker(true);
        connectionFactory.setBrokerContainerFactory(new SpringBrokerContainerFactory(new ClassPathResource("org/activemq/usecases/EmbeddedRemoteConnector.xml")));

        return connectionFactory;
    }
View Full Code Here



    public void testSendFromEmbeddedRemote() throws Exception {

        ActiveMQConnectionFactory embeddedRemoteFactory = createEmbeddedRemoteBrokerConnectionFactory();
        Connection conn = embeddedRemoteFactory.createConnection();
        Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Destination destination = session.createQueue(subject);
        MessageProducer producer = session.createProducer(destination);
        producer.setDeliveryMode(DeliveryMode.PERSISTENT);
View Full Code Here


    }

    public void testReceiver() throws Exception {
        ActiveMQConnectionFactory receiveFactory = createReceiverConnectionFactory();

        Connection conn = receiveFactory.createConnection();
        Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Destination destination = session.createQueue(subject);
        MessageConsumer consumer = session.createConsumer(destination);
        conn.start();
View Full Code Here

            broker.stop();
        }
    }

    protected ActiveMQConnectionFactory createConnectionFactory() {
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
        factory.setBrokerURL("openwire://localhost:61626");
        return factory;

    }
View Full Code Here

    protected Connection createSendConnection() throws Exception {
        return createConnection();
    }

    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
        return new ActiveMQConnectionFactory("vm://localhost");
    }
View Full Code Here

        connector.setRef("test");
        connector.setBeanFactory(jcac.getBeanFactory());
        connector.afterPropertiesSet();
       
        // Fire a test message into the broker.
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost");
        Connection connection = factory.createConnection();
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue queue = session.createQueue("GauntletWorkQueue");
        MessageProducer producer = session.createProducer(queue);
        producer.send(session.createTextMessage("test"));
        System.out.println("Message sent");
View Full Code Here

        brokerContainer.getBroker().addConsumerInfoListener(NetworkChannel.this);
    }

    private synchronized void initializeRemote() throws JMSException {
        if (remoteConnection == null) {
            ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(remoteUserName, remotePassword, uri);
            //factory.setTurboBoost(true);
            factory.setJ2EEcompliant(false);
            factory.setQuickClose(true);
            factory.setInternalConnection(true);
            remoteConnection = (ActiveMQConnection) factory.createConnection();
            TransportChannel transportChannel = remoteConnection.getTransportChannel();
            if (transportChannel instanceof CompositeTransportChannel) {
                CompositeTransportChannel composite = (CompositeTransportChannel) transportChannel;
                composite.setMaximumRetries(maximumRetries);
                composite.setFailureSleepTime(reconnectSleepTime);
View Full Code Here

        doSetConnected();
    }

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

       
        String[] names = getConnectionFactoryNames(environment);
        for (int i = 0; i < names.length; i++) {
           
            String name = names[i];
            ActiveMQConnectionFactory factory = createConnectionFactory(name, environment);
           
            if( broker==null ) {
                try {
                    broker = factory.getEmbeddedBroker();
                }
                catch (JMSException e) {
                    log.warn("Failed to get embedded broker", e);
                }
            }
View Full Code Here

TOP

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