Package org.apache.qpid.jms

Examples of org.apache.qpid.jms.BrokerDetails


        connection.close();
    }
   
    public void testUnsupportedSASLMechanism() throws Exception
    {
        BrokerDetails broker = getBroker();
        broker.setProperty(BrokerDetails.OPTIONS_SASL_MECHS, "MY_MECH");

        try
        {
            Connection connection = new AMQConnection(broker.toString(), "guest", "guest",
                    null, "test");
            connection.close();
            fail("The client should throw a ConnectionException stating the" +
                " broker does not support the SASL mech specified by the client");
        }
View Full Code Here


                for (String url:urls)
                {
                    String[] tokens = url.split(":");
                    if (tokens[0].equalsIgnoreCase(_originalBrokerDetail.getTransport()))
                    {
                        BrokerDetails broker = new AMQBrokerDetails();
                        broker.setTransport(tokens[0]);
                        broker.setHost(tokens[1]);
                        broker.setPort(Integer.parseInt(tokens[2]));
                        broker.setProperties(_originalBrokerDetail.getProperties());
                        broker.setSSLConfiguration(_originalBrokerDetail.getSSLConfiguration());
                        brokerList.add(broker);
                       
                        if (currentBrokerIP.equals(broker.getHost()) &&
                            _currentBrokerDetail.getPort() == broker.getPort())
                        {
                            _currentBrokerIndex = brokerList.indexOf(broker);
                        }
                       
                        break;
View Full Code Here

        }
    }  
   
    public BrokerDetails getNextBrokerDetails()
    {
        BrokerDetails broker = null;

        synchronized(_brokerListLock)
        {
            if (_currentBrokerIndex == (_connectionDetails.getBrokerCount() - 1))
            {
                _currentBrokerIndex = 0;
            }
            else
            {
                _currentBrokerIndex++;
            }
           
            broker = _connectionDetails.getBrokerDetails(_currentBrokerIndex);
           
            // When the broker list is updated it will include the current broker as well
            // There is no point trying it again, so trying the next one.
            if (_currentBrokerDetail != null &&
                broker.getHost().equals(_currentBrokerDetail.getHost()) &&
                broker.getPort() == _currentBrokerDetail.getPort())
            {
                if (_connectionDetails.getBrokerCount() > 1)
                {
                    return getNextBrokerDetails();
                }
                else
                {
                    _failedAttemps ++;
                    return null;
                }
            }
        }

        String delayStr = broker.getProperty(BrokerDetails.OPTIONS_CONNECT_DELAY);
        if (delayStr != null)
        {
            Long delay = Long.parseLong(delayStr);
            _logger.info("Delay between connect retries:" + delay);
            try
View Full Code Here

        if (!(o instanceof BrokerDetails))
        {
            return false;
        }

        BrokerDetails bd = (BrokerDetails) o;

        return _host.equalsIgnoreCase(bd.getHost()) &&
               (_port == bd.getPort()) &&
               _transport.equalsIgnoreCase(bd.getTransport()) &&
               compareSSLConfigurations(bd.getSSLConfiguration());
        //todo do we need to compare all the options as well?
    }
View Full Code Here

       
        String amqpVersion = System.getProperty((ClientProperties.AMQP_VERSION), "0-10");
        _logger.debug("AMQP version " + amqpVersion);
       
        _failoverPolicy = new FailoverPolicy(connectionURL, this);
        BrokerDetails brokerDetails = _failoverPolicy.getCurrentBrokerDetails();
        if (brokerDetails.getTransport().equals(BrokerDetails.VM) || "0-8".equals(amqpVersion))
        {
            _delegate = new AMQConnectionDelegate_8_0(this);
        }
        else if ("0-9".equals(amqpVersion))
        {
View Full Code Here

        _virtualHost = virtualHost;
    }

    public boolean attemptReconnection(String host, int port)
    {
        BrokerDetails bd = new AMQBrokerDetails(host, port, _sslConfiguration);

        _failoverPolicy.setBroker(bd);

        try
        {
View Full Code Here

        return false;
    }

    public boolean attemptReconnection()
    {
        BrokerDetails broker = null;
        while (_failoverPolicy.failoverAllowed() && (broker = _failoverPolicy.getNextBrokerDetails()) != null)
        {
            try
            {
                makeBrokerConnection(broker);
View Full Code Here

        {
            buf.append("No active broker connection");
        }
        else
        {
            BrokerDetails bd = _failoverPolicy.getCurrentBrokerDetails();
            buf.append("Host: ").append(String.valueOf(bd.getHost()));
            buf.append("\nPort: ").append(String.valueOf(bd.getPort()));
        }

        buf.append("\nVirtual Host: ").append(String.valueOf(_virtualHost));
        buf.append("\nClient ID: ").append(String.valueOf(_clientName));
        buf.append("\nActive session count: ").append((_sessions == null) ? 0 : _sessions.size());
View Full Code Here

        assertTrue(connectionurl.getPassword().equals("bob"));
        assertTrue(connectionurl.getVirtualHost().equals("/test"));

        assertTrue(connectionurl.getBrokerCount() == 2);

        BrokerDetails service = connectionurl.getBrokerDetails(0);

        assertTrue(service.getTransport().equals("tcp"));
        assertTrue(service.getHost().equals("localhost"));
        assertTrue(service.getPort() == 5672);

        service = connectionurl.getBrokerDetails(1);

        assertTrue(service.getTransport().equals("tcp"));
        assertTrue(service.getHost().equals("fancyserver"));
        assertTrue(service.getPort() == 3000);

    }
View Full Code Here

        assertTrue(connectionurl.getPassword().equals("bob"));
        assertTrue(connectionurl.getVirtualHost().equals("/test"));

        assertTrue(connectionurl.getBrokerCount() == 1);

        BrokerDetails service = connectionurl.getBrokerDetails(0);

        assertTrue(service.getTransport().equals("tcp"));
        assertTrue(service.getHost().equals("localhost"));
        assertTrue(service.getPort() == 5672);
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.jms.BrokerDetails

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.