Examples of AMQConnectionFactory


Examples of org.apache.qpid.client.AMQConnectionFactory

             * [&option='value']"
             */
            String brokerUrl = "amqp://guest:guest@" + virtualHost + "?brokerlist='" + brokerlist + "'";
            try
            {
                AMQConnectionFactory factory = new AMQConnectionFactory(new AMQConnectionURL(brokerUrl));
                _logger.info("connecting to Qpid :" + brokerUrl);
                connection = factory.createConnection();

                // register exception listener
                connection.setExceptionListener(this);

                session = ((AMQConnection) connection).createSession(transacted, ackMode, prefetch);
View Full Code Here

Examples of org.apache.qpid.client.AMQConnectionFactory

            //get an initial context from default properties
            _contextHelper = new InitialContextHelper(null);
            InitialContext ctx = _contextHelper.getInitialContext();

            //then create a connection using the AMQConnectionFactory
            AMQConnectionFactory cf = (AMQConnectionFactory) ctx.lookup("local");
            _connection = cf.createConnection();

            _connection.setExceptionListener(new ExceptionListener()
            {
                public void onException(JMSException jmse)
                {
View Full Code Here

Examples of org.apache.qpid.client.AMQConnectionFactory

     */
    public void testIsSameRMMultiCF() throws Exception
    {
        startBroker(FAILING_PORT);
        ConnectionURL url = getConnectionFactory(FACTORY_NAME).getConnectionURL();
        XAConnectionFactory factory = new AMQConnectionFactory(url);
        XAConnectionFactory factory2 = new AMQConnectionFactory(url);
        XAConnectionFactory factory3 = getConnectionFactory(ALT_FACTORY_NAME);
       
        XAConnection conn = factory.createXAConnection();
        XAConnection conn2 = factory2.createXAConnection();
        XAConnection conn3 = factory3.createXAConnection();
       
        XASession session = conn.createXASession();
        XASession session2 = conn2.createXASession();
        XASession session3 = conn3.createXASession();
View Full Code Here

Examples of org.apache.qpid.client.AMQConnectionFactory

             * [&option='value']"
             */
            String brokerUrl = "amqp://guest:guest@" + virtualHost + "?brokerlist='" + brokerlist + "'";
            try
            {
                AMQConnectionFactory factory = new AMQConnectionFactory(new AMQConnectionURL(brokerUrl));
                _logger.info("connecting to Qpid :" + brokerUrl);
                connection = factory.createConnection();

                // register exception listener
                connection.setExceptionListener(this);

                session = ((AMQConnection) connection).createSession(transacted, ackMode, prefetch);
View Full Code Here

Examples of org.apache.qpid.client.AMQConnectionFactory

            System.exit(1);
        }

        //Retreive the local factory from the properties file
        // when used with perftest.properties this will be localhost:5672
        AMQConnectionFactory factory = (AMQConnectionFactory) new InitialContext().lookup("default");

        AMQConnection connection = (AMQConnection) factory.createConnection("guest", "guest");

        //Use the AMQConnection Interface to set the prefetch to the number
        // we are sending
        Session session = connection.createSession(false,
                                                   Session.CLIENT_ACKNOWLEDGE,
View Full Code Here

Examples of org.apache.qpid.client.AMQConnectionFactory

    }

    public Connection getConnection(ConnectionURL url) throws JMSException
    {
        _logger.info(url.getURL());
        Connection connection = new AMQConnectionFactory(url).createConnection(url.getUsername(), url.getPassword());

        _connections.add(connection);

        return connection;
    }
View Full Code Here

Examples of org.apache.qpid.client.AMQConnectionFactory

    public void testCreateConnectionWithUsernamePassword() throws Exception
    {
       
        String brokerUrl = getBroker().toString();
        String URL = "amqp://guest:guest@clientID/test?brokerlist='" + brokerUrl + "'";
        AMQConnectionFactory factory = new AMQConnectionFactory(URL);
       
        AMQConnection con = (AMQConnection)factory.createConnection();
        assertEquals("Usernames used is different from the one in URL","guest",con.getConnectionURL().getUsername());
        assertEquals("Password used is different from the one in URL","guest",con.getConnectionURL().getPassword());
    
        try
        {
            AMQConnection con2 = (AMQConnection)factory.createConnection("user","pass");
            assertEquals("Usernames used is different from the one in URL","user",con2.getConnectionURL().getUsername());
            assertEquals("Password used is different from the one in URL","pass",con2.getConnectionURL().getPassword());
        }
        catch(Exception e)
        {
            // ignore
        }
       
        AMQConnection con3 = (AMQConnection)factory.createConnection();
        assertEquals("Usernames used is different from the one in URL","guest",con3.getConnectionURL().getUsername());
        assertEquals("Password used is different from the one in URL","guest",con3.getConnectionURL().getPassword());
    }
View Full Code Here

Examples of org.apache.qpid.client.AMQConnectionFactory

    {
        try
        {
            final ConnectionURL connectionUrl = new AMQConnectionURL(ConnectionURL.AMQ_PROTOCOL +
                    "://guest:guest@/test_path?brokerlist='tcp://" + config.getHost() + ":" + config.getPort() + "'");
            return new AMQConnectionFactory(connectionUrl);
        }
        catch (URLSyntaxException e)
        {
            throw new RuntimeException("Problem building URL", e);
        }
View Full Code Here

Examples of org.apache.qpid.client.AMQConnectionFactory

        {
            print(key + ":" + object);
        }
        else if (object instanceof AMQConnectionFactory)
        {
            AMQConnectionFactory factory = (AMQConnectionFactory) object;
            print(key + ":Connection");
            print("ConnectionURL:");
            print(factory.getConnectionURL().toString());
            print("FailoverPolicy");
            print(new FailoverPolicy(factory.getConnectionURL(),null).toString());
            print("");
        }
    }
View Full Code Here

Examples of org.apache.qpid.client.AMQConnectionFactory

     */
    protected ConnectionFactory createFactory(String url) throws ConfigurationException
    {
        try
        {
            return new AMQConnectionFactory(url);
        }
        catch (URLSyntaxException urlse)
        {
            _logger.warn("Unable to create factory:" + urlse);

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.