Package org.activemq

Examples of org.activemq.ActiveMQConnectionFactory.createConnection()


     */
    public ActiveMQConnection makeConnection(ActiveMQActivationSpec activationSpec) throws JMSException {
        ActiveMQConnectionFactory connectionFactory = getConnectionFactory();
        String userName = defaultValue(activationSpec.getUserName(), info.getUserName());
        String password = defaultValue(activationSpec.getPassword(), info.getPassword());
        ActiveMQConnection physicalConnection = (ActiveMQConnection) connectionFactory.createConnection(userName, password);
        if (activationSpec.isDurableSubscription()) {
            physicalConnection.setClientID(activationSpec.getClientId());
        }
        return physicalConnection;
    }
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

        remoteBroker = new BrokerContainerImpl("remoteBroker");
        remoteBroker.addConnector(ActiveMQConnection.DEFAULT_BROKER_URL);
        remoteBroker.start();
       
        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory("remote://" + URL + "?brokerName=receiver");
        consumerConnection = fac.createConnection();
        consumerConnection.setClientID("receiver");
        consumerConnection.start();
       
        fac = new ActiveMQConnectionFactory("remote://" + URL + "?brokerName=sender");
        producerConnection = fac.createConnection();
View Full Code Here

        consumerConnection = fac.createConnection();
        consumerConnection.setClientID("receiver");
        consumerConnection.start();
       
        fac = new ActiveMQConnectionFactory("remote://" + URL + "?brokerName=sender");
        producerConnection = fac.createConnection();
        producerConnection.start();
       
       
       
       
View Full Code Here

   
   
    protected void setUp() throws Exception{
        started = new SynchronizedBoolean(false);
        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory("vm://localhost");
        connection = fac.createConnection();
        session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
        destination = session.createTopic(destinationName);
        connection.start();
    }
   
View Full Code Here

            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

        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

    protected void setUp() throws Exception {
        brokerUrl = "tcp://localhost:6099";
        subject = this.getClass().getName();
        String url = "peer://" + brokerUrl;
        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory(url);
        brokerConnection = fac.createConnection();
        brokerConnection.start();
    }

    protected void tearDown() throws Exception {
        if (brokerConnection != null) {
View Full Code Here

        String topicName = "TestTopic";
        String clientID = getName();
        String subscriberName = "MySubscriber:"+System.currentTimeMillis();

        Connection connection = connectionFactory.createConnection();
        connection.setClientID(clientID);

        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Topic topic = session.createTopic(topicName);
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.