Search in sources :

Example 1 with BrokerDetails

use of org.apache.qpid.jms.BrokerDetails in project candlepin by candlepin.

the class QpidConnection method createConnectionFactory.

private AMQConnectionFactory createConnectionFactory() throws NamingException {
    log.debug("looking up QpidConnectionfactory");
    AMQConnectionFactory connectionFactory = (AMQConnectionFactory) ctx.lookup("qpidConnectionfactory");
    Map<String, String> configProperties = config.buildBrokerDetails(ctx);
    for (BrokerDetails broker : connectionFactory.getConnectionURL().getAllBrokerDetails()) {
        for (Entry<String, String> prop : configProperties.entrySet()) {
            // specified in the broker urls.
            if (prop.getKey().equals("retries") || prop.getKey().equals("connectdelay")) {
                if (broker.getProperty(prop.getKey()) != null) {
                    continue;
                }
            }
            broker.setProperty(prop.getKey(), prop.getValue());
        }
        log.debug("Broker configured: " + broker);
    }
    log.info("AMQP connection factory created.");
    return connectionFactory;
}
Also used : AMQConnectionFactory(org.apache.qpid.client.AMQConnectionFactory) BrokerDetails(org.apache.qpid.jms.BrokerDetails)

Aggregations

AMQConnectionFactory (org.apache.qpid.client.AMQConnectionFactory)1 BrokerDetails (org.apache.qpid.jms.BrokerDetails)1