Examples of AMQConnectionFactory


Examples of org.apache.qpid.client.AMQConnectionFactory

                            "'tcp://%s:%s?retries='%s'&connectdelay='%s''&failover='singlebroker?cyclecount='%s''";

        String newUrl = String.format(newUrlFormat, origBrokerDetails.getHost(), origBrokerDetails.getPort(),
                                                    retries, connectdelay, cycleCount);

        ConnectionFactory connectionFactory = new AMQConnectionFactory(newUrl);
        AMQConnection connection = (AMQConnection) connectionFactory.createConnection("admin", "admin");
        connection.setConnectionListener(this);
        return connection;
    }
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("guest","guest");
        XAConnection conn2 = factory2.createXAConnection("guest","guest");
        XAConnection conn3 = factory3.createXAConnection("guest","guest");

        XASession session = conn.createXASession();
        XASession session2 = conn2.createXASession();
        XASession session3 = conn3.createXASession();
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

      final Integer port = (overridePort != null ? overridePort : _raProperties.getPort()) ;

      final String overridePath = overrideProperties.getPath() ;
      final String path = (overridePath != null ? overridePath : _raProperties.getPath()) ;

      final AMQConnectionFactory cf ;

      if (url != null)
      {
         cf = new AMQConnectionFactory(url) ;

         if (clientID != null)
         {
            cf.getConnectionURL().setClientName(clientID) ;
         }
      }
      else
      {
         // create a URL to force the connection details
         if ((host == null) || (port == null) || (path == null))
         {
            throw new QpidRAException("Configuration requires host/port/path if connectionURL is not specified") ;
         }
         final String username = (defaultUsername != null ? defaultUsername : "") ;
         final String password = (defaultPassword != null ? defaultPassword : "") ;
         final String client = (clientID != null ? clientID : "") ;

         final String newurl = AMQConnectionURL.AMQ_PROTOCOL + "://" + username +":" + password + "@" + client + "/" + path + '?' + AMQConnectionURL.OPTIONS_BROKERLIST + "='tcp://" + host + ':' + port + '\'' ;
        
         if (_log.isDebugEnabled())
         {
            _log.debug("Initialising connectionURL to " + newurl) ;
         }

         cf = new AMQConnectionFactory(newurl) ;
      }

      return cf ;
   }
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();

            //create a transactional session
            _session = _connection.createSession(true, Session.AUTO_ACKNOWLEDGE);

            //lookup the example queue and use it
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()).toString());
            print("");
        }
    }
View Full Code Here

Examples of org.apache.qpid.client.AMQConnectionFactory

            // Create the object to be bound
            ConnectionFactory factory = null;

            try
            {
                factory = new AMQConnectionFactory(CONNECTION_URL);


                try
                {
                    Object obj = ctx.lookup(binding);
View Full Code Here

Examples of org.apache.qpid.client.AMQConnectionFactory

    private void checkPropertiesMatch(Context ctx, String errorInfo)
    {
        try
        {
            AMQConnectionFactory cf = (AMQConnectionFactory) ctx.lookup("local");
            assertEquals("amqp://guest:guest@clientid/testpath?brokerlist='vm://:1'", cf.getConnectionURL().toString());
        }
        catch (NamingException ne)
        {
            fail(errorInfo + "Unable to create Connection Factory:" + ne);
        }
View Full Code Here

Examples of org.apache.qpid.client.AMQConnectionFactory

     */
    protected ConnectionFactory createFactory(String url)
    {
        try
        {
            return new AMQConnectionFactory(url);
        }
        catch (URLSyntaxException urlse)
        {
            _logger.warn("Unable to createFactories:" + urlse);
        }
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();

            //create a transactional session
            _session = _connection.createSession(true, Session.AUTO_ACKNOWLEDGE);

            //lookup the example queue and use it
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.