Package org.activemq

Examples of org.activemq.ActiveMQConnectionFactory


        initializeRemote();
    }

    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


        }
    }

    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

public class PooledConnectionFactory implements ConnectionFactory, Service {
    private ActiveMQConnectionFactory connectionFactory;
    private Map cache = new HashMap();

    public PooledConnectionFactory() {
        this(new ActiveMQConnectionFactory());
    }
View Full Code Here

    public PooledConnectionFactory() {
        this(new ActiveMQConnectionFactory());
    }

    public PooledConnectionFactory(String brokerURL) {
        this(new ActiveMQConnectionFactory(brokerURL));
    }
View Full Code Here

                return factory.createQueueConnection();

            }
        } else {
            //Used to create a session from the default MQ server ActiveMQConnectionFactory.
            ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(url);

            if (embeddedBroker) {
                factory.setUseEmbeddedBroker(true);
            }

            factory.setTurboBoost(true);
            ActiveMQConnection c = (ActiveMQConnection) factory.createConnection();

            c.getPrefetchPolicy().setQueuePrefetch(1000);
            c.getPrefetchPolicy().setQueueBrowserPrefetch(1000);
            c.getPrefetchPolicy().setTopicPrefetch(1000);
            c.getPrefetchPolicy().setDurableTopicPrefetch(1000);
View Full Code Here

public class InitialContextTest extends TestCase {
    public void testInitialContext() throws Exception {
        InitialContext context = new InitialContext();
        assertTrue("Created context", context != null);

        ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) context.lookup("ConnectionFactory");

        assertTrue("Should have created a ConnectionFactory", connectionFactory != null);

        System.out.println("Created with brokerURL: " + connectionFactory.getBrokerURL());

    }
View Full Code Here

        properties.put("brokerURL", expected);

        InitialContext context = new InitialContext(properties);
        assertTrue("Created context", context != null);

        ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) context.lookup("ConnectionFactory");

        assertTrue("Should have created a ConnectionFactory", connectionFactory != null);

        assertEquals("the brokerURL should match", expected, connectionFactory.getBrokerURL());
    }
View Full Code Here

        properties.put(Context.PROVIDER_URL, expected);

        InitialContext context = new InitialContext(properties);
        assertTrue("Created context", context != null);

        ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) context.lookup("ConnectionFactory");

        assertTrue("Should have created a ConnectionFactory", connectionFactory != null);

        assertEquals("the brokerURL should match", expected, connectionFactory.getBrokerURL());
    }
View Full Code Here

            BrokerContainerFactory brokerContainerFactory = XmlConfigHelper.createBrokerContainerFactory(getBrokerXmlConfig());

            IdGenerator idgen = new IdGenerator();
            container = brokerContainerFactory.createBrokerContainer(idgen.generateId(), BrokerContext.getInstance());
            container.start();
            connectionFactory = new ActiveMQConnectionFactory(container, getServerUrl());
        } catch (JMSException e) {
            log.error(e.toString(), e);
            throw new ResourceAdapterInternalException("Failed to startup an embedded broker", e);
        }
    }
View Full Code Here

    /**
     */
    public ActiveMQConnection makeConnection() throws JMSException {

        ActiveMQConnectionFactory connectionFactory = getConnectionFactory();

        String userName = info.getUserName();
        String password = info.getPassword();
        ActiveMQConnection physicalConnection = (ActiveMQConnection) connectionFactory.createConnection(userName, password);

        String clientId = info.getClientid();
        if (clientId != null) {
            physicalConnection.setClientID(clientId);
        }
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.